@azure/msal-react package
Antarmuka
| IMsalContext |
Alias Jenis
| AccountIdentifiers | |
| AuthenticatedTemplateProps | |
| MsalAuthenticationProps | |
| MsalAuthenticationResult | |
| MsalProviderProps | |
| SetComplement | |
| SetDifference | |
| Subtract | |
| UnauthenticatedTemplateProps | |
| WithMsalProps |
Fungsi
Variabel
| Msal |
|
| Msal |
|
| version |
Detail Fungsi
AuthenticatedTemplate(PropsWithChildren<Partial<Pick<AccountInfo, "homeAccountId" | "localAccountId" | "username">>>)
Merender komponen anak jika pengguna diautentikasi
function AuthenticatedTemplate(props: PropsWithChildren<Partial<Pick<AccountInfo, "homeAccountId" | "localAccountId" | "username">>>): React.ReactElement | null
Parameter
- props
-
PropsWithChildren<Partial<Pick<AccountInfo, "homeAccountId" | "localAccountId" | "username">>>
Mengembalikan
React.ReactElement | null
MsalAuthenticationTemplate(PropsWithChildren<Partial<Pick<AccountInfo, "homeAccountId" | "localAccountId" | "username">> & { authenticationRequest?: PopupRequest | RedirectRequest | Partial<Omit<CommonAuthorizationUrlRequest, "responseMode" | "earJwk" | "codeChallenge" | "codeChallengeMethod" | "requestedClaimsHash" | "platformBroker">>, errorComponent?: any, interactionType: InteractionType, loadingComponent?: any }>)
Mencoba mengautentikasi pengguna jika belum diautentikasi, lalu merender komponen turunan
function MsalAuthenticationTemplate(props: PropsWithChildren<Partial<Pick<AccountInfo, "homeAccountId" | "localAccountId" | "username">> & { authenticationRequest?: PopupRequest | RedirectRequest | Partial<Omit<CommonAuthorizationUrlRequest, "responseMode" | "earJwk" | "codeChallenge" | "codeChallengeMethod" | "requestedClaimsHash" | "platformBroker">>, errorComponent?: any, interactionType: InteractionType, loadingComponent?: any }>): React.ReactElement | null
Parameter
- props
-
PropsWithChildren<Partial<Pick<AccountInfo, "homeAccountId" | "localAccountId" | "username">> & { authenticationRequest?: PopupRequest | RedirectRequest | Partial<Omit<CommonAuthorizationUrlRequest, "responseMode" | "earJwk" | "codeChallenge" | "codeChallengeMethod" | "requestedClaimsHash" | "platformBroker">>, errorComponent?: any, interactionType: InteractionType, loadingComponent?: any }>
Mengembalikan
React.ReactElement | null
MsalProvider(PropsWithChildren<{ instance: IPublicClientApplication }>)
Komponen penyedia konteks MSAL. Ini harus dirender di atas komponen lain yang menggunakan MSAL.
function MsalProvider(__namedParameters: PropsWithChildren<{ instance: IPublicClientApplication }>): React.ReactElement
Parameter
- __namedParameters
-
PropsWithChildren<{ instance: IPublicClientApplication }>
Mengembalikan
UnauthenticatedTemplate(PropsWithChildren<Partial<Pick<AccountInfo, "homeAccountId" | "localAccountId" | "username">>>)
Merender komponen anak jika pengguna tidak diautentikasi
function UnauthenticatedTemplate(props: PropsWithChildren<Partial<Pick<AccountInfo, "homeAccountId" | "localAccountId" | "username">>>): React.ReactElement | null
Parameter
- props
-
PropsWithChildren<Partial<Pick<AccountInfo, "homeAccountId" | "localAccountId" | "username">>>
Mengembalikan
React.ReactElement | null
useAccount(Partial<Pick<AccountInfo, "homeAccountId" | "localAccountId" | "username">>)
Mengingat 1 atau lebih accountIdentifiers, mengembalikan objek Akun jika pengguna masuk
function useAccount(accountIdentifiers?: Partial<Pick<AccountInfo, "homeAccountId" | "localAccountId" | "username">>): AccountInfo | null
Parameter
- accountIdentifiers
-
Partial<Pick<AccountInfo, "homeAccountId" | "localAccountId" | "username">>
Mengembalikan
AccountInfo | null
useIsAuthenticated(Partial<Pick<AccountInfo, "homeAccountId" | "localAccountId" | "username">>)
Mengembalikan apakah pengguna saat ini masuk atau tidak. Secara opsional sediakan 1 atau lebih accountIdentifiers untuk menentukan apakah pengguna tertentu masuk
function useIsAuthenticated(matchAccount?: Partial<Pick<AccountInfo, "homeAccountId" | "localAccountId" | "username">>): boolean
Parameter
- matchAccount
-
Partial<Pick<AccountInfo, "homeAccountId" | "localAccountId" | "username">>
Mengembalikan
boolean
useMsal()
useMsalAuthentication(InteractionType, PopupRequest | RedirectRequest | Partial<Omit<CommonAuthorizationUrlRequest, "responseMode" | "earJwk" | "codeChallenge" | "codeChallengeMethod" | "requestedClaimsHash" | "platformBroker">>, Partial<Pick<AccountInfo, "homeAccountId" | "localAccountId" | "username">>)
Jika pengguna saat ini tidak masuk, hook ini memanggil login. Login yang gagal dapat dicoba kembali menggunakan panggilan balik masuk yang dikembalikan. Jika pengguna saat ini masuk ke hook ini mencoba memperoleh token. Permintaan token berikutnya dapat menggunakan panggilan balik acquireToken yang dikembalikan. Secara opsional berikan objek permintaan yang akan digunakan dalam panggilan login/acquireToken. Secara opsional berikan pengguna tertentu yang harus masuk.
function useMsalAuthentication(interactionType: InteractionType, authenticationRequest?: PopupRequest | RedirectRequest | Partial<Omit<CommonAuthorizationUrlRequest, "responseMode" | "earJwk" | "codeChallenge" | "codeChallengeMethod" | "requestedClaimsHash" | "platformBroker">>, accountIdentifiers?: Partial<Pick<AccountInfo, "homeAccountId" | "localAccountId" | "username">>): MsalAuthenticationResult
Parameter
- interactionType
- InteractionType
- authenticationRequest
-
PopupRequest | RedirectRequest | Partial<Omit<CommonAuthorizationUrlRequest, "responseMode" | "earJwk" | "codeChallenge" | "codeChallengeMethod" | "requestedClaimsHash" | "platformBroker">>
- accountIdentifiers
-
Partial<Pick<AccountInfo, "homeAccountId" | "localAccountId" | "username">>
Mengembalikan
withMsal<P>(ComponentType<P>)
Komponen urutan yang lebih tinggi membungkus komponen yang disediakan dengan msal dengan menyuntikkan nilai konteks msal ke dalam alat peraga komponen
function withMsal<P>(Component: ComponentType<P>): FunctionComponent<Subtract<P, WithMsalProps>>
Parameter
- Component
-
ComponentType<P>
Mengembalikan
FunctionComponent<Subtract<P, WithMsalProps>>
Detail Variabel
MsalConsumer
MsalContext
version
version: "3.0.29"
Jenis
"3.0.29"