The operation handling an out-of-band authentication.

This is the object returned by the SDK, when an OutOfBandPayload was processed and the OutOfBandPayload corresponds to an authentication operation.

Usage example:

  class AccountSelectorImpl extends AccountSelector {
async selectAccount(
context: AccountSelectionContext,
handler: AccountSelectionHandler
): Promise<void> {
await handler.username(username).catch(console.error);
}
}

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: PinVerificationContext,
handler: PinVerificationHandler
): Promise<void> {
await handler.verifyPin(pin).catch(console.error);
}
}

class BiometricUserVerifierImpl extends BiometricUserVerifier {
async verifyBiometric(
context: BiometricUserVerificationContext,
handler: BiometricUserVerificationHandler
): Promise<void> {
await handler
.listenForOsCredentials(
BiometricPromptOptions.create(
'Biometric authentication required',
'Cancel',
'Please identify yourself.'
)
)
.catch(console.error);
}
}

async authenticateWithOutOfBand(
client: MobileAuthenticationClient,
payload: OutOfBandPayload
): Promise<void> {
await client.operations.outOfBandOperation
.payload(payload)
.onRegistration((registration) => {
// handle registration
})
.onAuthentication((authentication) => {
authentication
.accountSelector(new AccountSelectorImpl())
.authenticatorSelector(new AuthenticatorSelectorImpl())
.pinUserVerifier(new PinUserVerifierImpl())
.biometricUserVerifier(new BiometricUserVerifierImpl())
.onSuccess((authorizationProvider) => {
// handle success
})
.onError((error) => {
// handle error
})
.execute();
})
.onError((_error) => {
// handle out-of-band error
})
.execute();
}

Hierarchy

Methods

  • Executes the operation asynchronously.

    Returns Promise<void>

Generated using TypeDoc