Skip to content

AuthClient

Defined in: index.ts:204

Tool to manage authentication and identity

AuthClient

protected new AuthClient(_identity, _key, _chain, _storage, idleManager, _createOptions, _idpWindow?, _eventHandler?): AuthClient

Defined in: index.ts:338

PartialIdentity | Identity

SignIdentity | PartialIdentity

null | DelegationChain

AuthClientStorage

undefined | IdleManager

undefined | AuthClientCreateOptions

Window

(event) => void

AuthClient

idleManager: undefined | IdleManager

Defined in: index.ts:343

getIdentity(): Identity

Defined in: index.ts:421

Identity


isAuthenticated(): Promise<boolean>

Defined in: index.ts:425

Promise<boolean>


login(options?): Promise<void>

Defined in: index.ts:458

AuthClient Login - Opens up a new window to authenticate with Internet Identity

AuthClientLoginOptions

Options for logging in, merged with the options set during creation if any. Note: we only perform a shallow merge for the customValues property.

Promise<void>

const authClient = await AuthClient.create();
authClient.login({
identityProvider: 'http://<canisterID>.127.0.0.1:8000',
maxTimeToLive: BigInt (7) * BigInt(24) * BigInt(3_600_000_000_000), // 1 week
windowOpenerFeatures: "toolbar=0,location=0,menubar=0,width=500,height=500,left=100,top=100",
onSuccess: () => {
console.log('Login Successful!');
},
onError: (error) => {
console.error('Login Failed: ', error);
}
});

logout(options): Promise<void>

Defined in: index.ts:561

string

Promise<void>


static create(options): Promise<AuthClient>

Defined in: index.ts:224

Create an AuthClient to manage authentication and identity

AuthClientCreateOptions = {}

Options for creating an AuthClient

Promise<AuthClient>

const authClient = await AuthClient.create({
idleOptions: {
disableIdle: true
}
})