Skip to content
IC Reactor

AuthenticationManager

Defined in: react/src/auth/authentication-manager.ts:62

Manages Internet Identity sign-in, session restoration, and authentication state for a ClientManager.

const authentication = new AuthenticationManager({ clientManager })
const identity = await authentication.authenticate()

new AuthenticationManager(__namedParameters): AuthenticationManager

Defined in: react/src/auth/authentication-manager.ts:102

AuthenticationManagerParameters

AuthenticationManager

readonly clientManager: ClientManager

Defined in: react/src/auth/authentication-manager.ts:95

get authState(): AuthState

Defined in: react/src/auth/authentication-manager.ts:98

The current authentication state.

AuthState

subscribeAuthState(callback): () => void

Defined in: react/src/auth/authentication-manager.ts:158

(state) => void

() => void


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.

AuthenticationClientOptions

Promise<AuthClientLike | undefined>


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.

AuthenticationClientOptions

AuthClientLike | undefined


authenticate(): Promise<Identity | undefined>

Defined in: react/src/auth/authentication-manager.ts:238

Promise<Identity | undefined>


login(loginOptions?): Promise<void>

Defined in: react/src/auth/authentication-manager.ts:341

AuthenticationSignInOptions

Promise<void>


logout(options?): Promise<void>

Defined in: react/src/auth/authentication-manager.ts:399

string

Promise<void>