@azure/msal-react package
Interfaces
| IMsalContext | 
Type Aliases
| AccountIdentifiers | |
| AuthenticatedTemplateProps | |
| MsalAuthenticationProps | |
| MsalAuthenticationResult | |
| MsalProviderProps | |
| SetComplement | |
| SetDifference | |
| Subtract | |
| UnauthenticatedTemplateProps | |
| WithMsalProps | 
Functions
Function Details
		AuthenticatedTemplate(PropsWithChildren<Partial<Pick<AccountInfo, "homeAccountId" | "localAccountId" | "username">>>)
	        
	Renders child components if user is authenticated
function AuthenticatedTemplate(props: PropsWithChildren<Partial<Pick<AccountInfo, "homeAccountId" | "localAccountId" | "username">>>): React.ReactElement | nullParameters
- props
- 
				PropsWithChildren<Partial<Pick<AccountInfo, "homeAccountId" | "localAccountId" | "username">>> 
Returns
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 }>)
	                           
	Attempts to authenticate user if not already authenticated, then renders child components
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 | nullParameters
- 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 }> 
Returns
React.ReactElement | null
		MsalProvider(PropsWithChildren<{ instance: IPublicClientApplication }>)
	     
	MSAL context provider component. This must be rendered above any other components that use MSAL.
function MsalProvider(__namedParameters: PropsWithChildren<{ instance: IPublicClientApplication }>): React.ReactElementParameters
- __namedParameters
- 
				PropsWithChildren<{ instance: IPublicClientApplication }> 
Returns
		UnauthenticatedTemplate(PropsWithChildren<Partial<Pick<AccountInfo, "homeAccountId" | "localAccountId" | "username">>>)
	        
	Renders child components if user is unauthenticated
function UnauthenticatedTemplate(props: PropsWithChildren<Partial<Pick<AccountInfo, "homeAccountId" | "localAccountId" | "username">>>): React.ReactElement | nullParameters
- props
- 
				PropsWithChildren<Partial<Pick<AccountInfo, "homeAccountId" | "localAccountId" | "username">>> 
Returns
React.ReactElement | null
		useAccount(Partial<Pick<AccountInfo, "homeAccountId" | "localAccountId" | "username">>)
	      
	Given 1 or more accountIdentifiers, returns the Account object if the user is signed-in
function useAccount(accountIdentifiers?: Partial<Pick<AccountInfo, "homeAccountId" | "localAccountId" | "username">>): AccountInfo | nullParameters
- accountIdentifiers
- 
				Partial<Pick<AccountInfo, "homeAccountId" | "localAccountId" | "username">> 
Returns
AccountInfo | null
		useIsAuthenticated(Partial<Pick<AccountInfo, "homeAccountId" | "localAccountId" | "username">>)
	      
	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?: Partial<Pick<AccountInfo, "homeAccountId" | "localAccountId" | "username">>): booleanParameters
- matchAccount
- 
				Partial<Pick<AccountInfo, "homeAccountId" | "localAccountId" | "username">> 
Returns
boolean
		useMsal()
	 
	
		useMsalAuthentication(InteractionType, PopupRequest | RedirectRequest | Partial<Omit<CommonAuthorizationUrlRequest, "responseMode" | "earJwk" | "codeChallenge" | "codeChallengeMethod" | "requestedClaimsHash" | "platformBroker">>, Partial<Pick<AccountInfo, "homeAccountId" | "localAccountId" | "username">>)
	                     
	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 | Partial<Omit<CommonAuthorizationUrlRequest, "responseMode" | "earJwk" | "codeChallenge" | "codeChallengeMethod" | "requestedClaimsHash" | "platformBroker">>, accountIdentifiers?: Partial<Pick<AccountInfo, "homeAccountId" | "localAccountId" | "username">>): MsalAuthenticationResultParameters
- interactionType
- InteractionType
- authenticationRequest
- 
				PopupRequest | RedirectRequest | Partial<Omit<CommonAuthorizationUrlRequest, "responseMode" | "earJwk" | "codeChallenge" | "codeChallengeMethod" | "requestedClaimsHash" | "platformBroker">> 
- accountIdentifiers
- 
				Partial<Pick<AccountInfo, "homeAccountId" | "localAccountId" | "username">> 
Returns
		withMsal<P>(ComponentType<P>)
	  
	Higher order component wraps provided component with msal by injecting msal context values into the component's props
function withMsal<P>(Component: ComponentType<P>): FunctionComponent<Subtract<P, WithMsalProps>>Parameters
- Component
- 
				ComponentType<P> 
Returns
FunctionComponent<Subtract<P, WithMsalProps>>