The object that can be used to trigger an authentication operation.

Usage example:

 class AuthenticatorSelectorImpl extends AuthenticatorSelector {
async selectAuthenticator(
context: AuthenticatorSelectionContext,
handler: AuthenticatorSelectionHandler,
): Promise<void> {
await handler.aaid(aaid).catch(console.error);
}
}

class PinUserVerifierImpl extends PinUserVerifier {
async verifyPin(
context: PinUserVerificationContext,
handler: PinUserVerificationHandler,
): Promise<void> {
await handler.verifyPin(pin).catch(console.error);
}
}

class PasswordUserVerifierImpl extends PasswordUserVerifier {
async verifyPassword(
context: PasswordUserVerificationContext,
handler: PasswordUserVerificationHandler,
): Promise<void> {
await handler.verifyPassword(password).catch(console.error);
}
}

class BiometricUserVerifierImpl implements BiometricUserVerifier {
async verifyBiometric(
context: BiometricUserVerificationContext,
handler: BiometricUserVerificationHandler,
): Promise<void> {
await handler.verifyBiometric().catch(console.error);
}
}

[...]
async function authenticate(
client: MobileAuthenticationClient,
username: string,
sessionProvider?: SessionProvider,
): Promise<void> {
await client.operations.authentication
.username(username)
.sessionProvider(sessionProvider)
.authenticatorSelector(AuthenticatorSelectorImpl(...))
.pinUserVerifier(PinUserVerifierImpl(...))
.passwordUserVerifier(PasswordUserVerifierImpl(...))
.biometricUserVerifier(BiometricUserVerifierImpl(...))
.onSuccess((authorizationProvider) {
// handle success
})
.onError((error) {
// handle error
})
.execute();
}
[...]

Hierarchy (View Summary)

Methods

  • Specifies the username that must be used to authenticate.

    IMPORTANT
    Providing the username is required.

    WARNING
    The username is the technical user identifier stored in the Account.username property. Do not provide the login identifier (for example the users e-mail address) here. We recommend always using the username provided via LocalData.accounts.

    Parameters

    • username: string

      the username.

    Returns Authentication

    the Authentication object.

  • Executes the operation asynchronously.

    Returns Promise<void>