TotpMultiFactorGenerator class

Provider for generating aTotpMultiFactorAssertion.

Signature:

exportdeclareclassTotpMultiFactorGenerator

Properties

PropertyModifiersTypeDescription
FACTOR_IDstatic'totp'The identifier of the TOTP second factor:totp.

Methods

MethodModifiersDescription
assertionForEnrollment(secret, oneTimePassword)staticProvides aTotpMultiFactorAssertion to confirm ownership of the TOTP (time-based one-time password) second factor. This assertion is used to complete enrollment in TOTP second factor.
assertionForSignIn(enrollmentId, oneTimePassword)staticProvides aTotpMultiFactorAssertion to confirm ownership of the TOTP second factor. This assertion is used to complete signIn with TOTP as the second factor.
generateSecret(session)staticReturns a promise toTotpSecret which contains the TOTP shared secret key and other parameters. Creates a TOTP secret as part of enrolling a TOTP second factor. Used for generating a QR code URL or inputting into a TOTP app. This method uses the auth instance corresponding to the user in the multiFactorSession.

TotpMultiFactorGenerator.FACTOR_ID

The identifier of the TOTP second factor:totp.

Signature:

staticFACTOR_ID:'totp';

TotpMultiFactorGenerator.assertionForEnrollment()

Provides aTotpMultiFactorAssertion to confirm ownership of the TOTP (time-based one-time password) second factor. This assertion is used to complete enrollment in TOTP second factor.

Signature:

staticassertionForEnrollment(secret:TotpSecret,oneTimePassword:string):TotpMultiFactorAssertion;

Parameters

ParameterTypeDescription
secretTotpSecretATotpSecret containing the shared secret key and other TOTP parameters.
oneTimePasswordstringOne-time password from TOTP App.

Returns:

TotpMultiFactorAssertion

ATotpMultiFactorAssertion which can be used withMultiFactorUser.enroll().

TotpMultiFactorGenerator.assertionForSignIn()

Provides aTotpMultiFactorAssertion to confirm ownership of the TOTP second factor. This assertion is used to complete signIn with TOTP as the second factor.

Signature:

staticassertionForSignIn(enrollmentId:string,oneTimePassword:string):TotpMultiFactorAssertion;

Parameters

ParameterTypeDescription
enrollmentIdstringidentifies the enrolled TOTP second factor.
oneTimePasswordstringOne-time password from TOTP App.

Returns:

TotpMultiFactorAssertion

ATotpMultiFactorAssertion which can be used withMultiFactorResolver.resolveSignIn().

TotpMultiFactorGenerator.generateSecret()

Returns a promise toTotpSecret which contains the TOTP shared secret key and other parameters. Creates a TOTP secret as part of enrolling a TOTP second factor. Used for generating a QR code URL or inputting into a TOTP app. This method uses the auth instance corresponding to the user in the multiFactorSession.

Signature:

staticgenerateSecret(session:MultiFactorSession):Promise<TotpSecret>;

Parameters

ParameterTypeDescription
sessionMultiFactorSessionTheMultiFactorSession that the user is part of.

Returns:

Promise<TotpSecret>

A promise toTotpSecret.

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2024-01-19 UTC.