@azure/msal-react package
Msal |
MSAL context provider component. This must be rendered above any other components that use MSAL. |
Authenticated |
Renders child components if user is authenticated |
Msal |
Attempts to authenticate user if not already authenticated, then renders child components |
Unauthenticated |
Renders child components if user is unauthenticated |
use |
Given 1 or more accountIdentifiers, returns the Account object if the user is signed-in |
use |
Returns whether or not a user is currently signed-in. Optionally provide 1 or more accountIdentifiers to determine if a specific user is signed-in |
use |
If a user is not currently signed in this hook invokes a login. Failed logins can be retried using the login callback returned. If a user is currently signed in this hook attempts to acquire a token. Subsequent token requests can use the acquireToken callback returned. Optionally provide a request object to be used in the login/acquireToken call. Optionally provide a specific user that should be logged in. |
account |
Helper function to determine whether 2 arrays are equal Used to avoid unnecessary state updates |
get |
|
get |
MSAL context provider component. This must be rendered above any other components that use MSAL.
function MsalProvider(__namedParameters: { children: any, instance: any }): React.ReactElement
Parameters
- __namedParameters
-
{ children: any, instance: any }
Returns
Renders child components if user is authenticated
function AuthenticatedTemplate(__namedParameters: { children: any, homeAccountId: any, localAccountId: any, username: any }): React.ReactElement | null
Parameters
- __namedParameters
-
{ children: any, homeAccountId: any, localAccountId: any, username: any }
Returns
React.ReactElement | null
MsalAuthenticationTemplate({ ErrorComponent: any, LoadingComponent: any, authenticationRequest: any, children: any, homeAccountId: any, interactionType: any, localAccountId: any, username: any })
Attempts to authenticate user if not already authenticated, then renders child components
function MsalAuthenticationTemplate(__namedParameters: { ErrorComponent: any, LoadingComponent: any, authenticationRequest: any, children: any, homeAccountId: any, interactionType: any, localAccountId: any, username: any }): React.ReactElement | null
Parameters
- __namedParameters
-
{ ErrorComponent: any, LoadingComponent: any, authenticationRequest: any, children: any, homeAccountId: any, interactionType: any, localAccountId: any, username: any }
Returns
React.ReactElement | null
Renders child components if user is unauthenticated
function UnauthenticatedTemplate(__namedParameters: { children: any, homeAccountId: any, localAccountId: any, username: any }): React.ReactElement | null
Parameters
- __namedParameters
-
{ children: any, homeAccountId: any, localAccountId: any, username: any }
Returns
React.ReactElement | null
Given 1 or more accountIdentifiers, returns the Account object if the user is signed-in
function useAccount(accountIdentifiers?: AccountIdentifiers): AccountInfo | null
Parameters
- accountIdentifiers
- AccountIdentifiers
Returns
AccountInfo | null
Returns whether or not a user is currently signed-in. Optionally provide 1 or more accountIdentifiers to determine if a specific user is signed-in
function useIsAuthenticated(matchAccount?: AccountIdentifiers): boolean
Parameters
- matchAccount
- AccountIdentifiers
Returns
boolean
useMsalAuthentication(InteractionType, PopupRequest | RedirectRequest | SsoSilentRequest, AccountIdentifiers)
If a user is not currently signed in this hook invokes a login. Failed logins can be retried using the login callback returned. If a user is currently signed in this hook attempts to acquire a token. Subsequent token requests can use the acquireToken callback returned. Optionally provide a request object to be used in the login/acquireToken call. Optionally provide a specific user that should be logged in.
function useMsalAuthentication(interactionType: InteractionType, authenticationRequest?: PopupRequest | RedirectRequest | SsoSilentRequest, accountIdentifiers?: AccountIdentifiers): MsalAuthenticationResult
Parameters
- interactionType
-
InteractionType
- authenticationRequest
-
PopupRequest | RedirectRequest | SsoSilentRequest
- accountIdentifiers
- AccountIdentifiers
Returns
Helper function to determine whether 2 arrays are equal Used to avoid unnecessary state updates
function accountArraysAreEqual(arrayA: Array<AccountIdentifiers>, arrayB: Array<AccountIdentifiers>): boolean
Parameters
- arrayA
-
Array<AccountIdentifiers>
- arrayB
-
Array<AccountIdentifiers>
Returns
boolean
function getAccountByIdentifiers(allAccounts: AccountInfo[], accountIdentifiers: AccountIdentifiers): AccountInfo | null
Parameters
- allAccounts
-
AccountInfo[]
- accountIdentifiers
- AccountIdentifiers
Returns
AccountInfo | null
function getChildrenOrFunction<T>(children: React.ReactNode | FaaCFunction, args: T): React.ReactNode
Parameters
- children
-
React.ReactNode | FaaCFunction
- args
-
T