AuthenticationManager
Defined in: react/src/auth/authentication-manager.ts:62
Manages Internet Identity sign-in, session restoration, and authentication state for a ClientManager.
Example
Section titled “Example”const authentication = new AuthenticationManager({ clientManager })const identity = await authentication.authenticate()Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new AuthenticationManager(
__namedParameters):AuthenticationManager
Defined in: react/src/auth/authentication-manager.ts:102
Parameters
Section titled “Parameters”__namedParameters
Section titled “__namedParameters”AuthenticationManagerParameters
Returns
Section titled “Returns”AuthenticationManager
Properties
Section titled “Properties”clientManager
Section titled “clientManager”
readonlyclientManager:ClientManager
Defined in: react/src/auth/authentication-manager.ts:95
Accessors
Section titled “Accessors”authState
Section titled “authState”Get Signature
Section titled “Get Signature”get authState():
AuthState
Defined in: react/src/auth/authentication-manager.ts:98
The current authentication state.
Returns
Section titled “Returns”Methods
Section titled “Methods”subscribeAuthState()
Section titled “subscribeAuthState()”subscribeAuthState(
callback): () =>void
Defined in: react/src/auth/authentication-manager.ts:158
Parameters
Section titled “Parameters”callback
Section titled “callback”(state) => void
Returns
Section titled “Returns”() => void
prepareClient()
Section titled “prepareClient()”prepareClient(
options?):Promise<AuthClientLike|undefined>
Defined in: react/src/auth/authentication-manager.ts:175
Preloads the auth module and creates an AuthClient ahead of time.
Call (and await) this before wiring up a login button: it makes login and IdentityAttributesManager.request able to open the identity provider synchronously inside the click handler, which is what browser popup blockers and the ICRC-29 transport require.
Parameters
Section titled “Parameters”options?
Section titled “options?”Returns
Section titled “Returns”Promise<AuthClientLike | undefined>
getPreparedClient()
Section titled “getPreparedClient()”getPreparedClient(
options?):AuthClientLike|undefined
Defined in: react/src/auth/authentication-manager.ts:232
Returns an AuthClient without awaiting, or undefined when the auth
module has not been loaded yet.
Callers that must stay inside a user gesture use this instead of
ensureClient; awaiting anything before opening the identity
provider window loses the gesture.
Parameters
Section titled “Parameters”options?
Section titled “options?”Returns
Section titled “Returns”AuthClientLike | undefined
authenticate()
Section titled “authenticate()”authenticate():
Promise<Identity|undefined>
Defined in: react/src/auth/authentication-manager.ts:238
Returns
Section titled “Returns”Promise<Identity | undefined>
login()
Section titled “login()”login(
loginOptions?):Promise<void>
Defined in: react/src/auth/authentication-manager.ts:341
Parameters
Section titled “Parameters”loginOptions?
Section titled “loginOptions?”Returns
Section titled “Returns”Promise<void>
logout()
Section titled “logout()”logout(
options?):Promise<void>
Defined in: react/src/auth/authentication-manager.ts:399
Parameters
Section titled “Parameters”options?
Section titled “options?”returnTo?
Section titled “returnTo?”string
Returns
Section titled “Returns”Promise<void>