NativeAppAuthorization Class

Object to be set as IModelApp.authorizationClient for the frontend of NativeApps. Since NativeApps use the backend for all authorization, this class sends signIn/signOut requests to the backend and then listens for the onUserStateChanged event to cache the accessToken. The token is cached here on the frontend because it is used for every RPC operation, even when we're running as a NativeApp. We must therefore check for expiration and request refreshes as/when necessary.

Methods

Name Description
constructor(config?: NativeAppAuthorizationConfiguration): NativeAppAuthorization ctor for NativeAppAuthorization  
getAccessToken(): Promise<AccessToken> Returns a promise that resolves to the AccessToken if signed in.  
initialize(props: SessionProps): Promise<void> Used to initialize the the backend authorization.  
Called to start the sign-in process.  
signOut(): Promise<void> Called to start the sign-out process.  

Properties

Name Type Description
_expireSafety Protected number    
hasSignedIn Accessor ReadOnly boolean    
isAuthorized Accessor ReadOnly boolean    
onUserStateChanged Readonly BeEvent<(token?: AccessToken) => void>    

Defined in

Last Updated: 29 November, 2022