TotpMultiFactorGenerator

classTotpMultiFactorGenerator


Helper class used to generate aTotpMultiFactorAssertion.

Summary

Constants

constString!
FACTOR_ID = "totp"

Public functions

java-staticTask<TotpSecret!>

Creates a TOTP secret as part of enrolling a TOTP (time-based one-time password) second factor.

java-staticTotpMultiFactorAssertion

Creates an assertion for completing the enrollment flow.

java-staticTotpMultiFactorAssertion
getAssertionForSignIn(enrollmentId: String, otp: String)

Creates an assertion for the sign-in flow.

Constants

FACTOR_ID

const val FACTOR_ID = "totp": String!

Public functions

generateSecret

java-static fun generateSecret(session: MultiFactorSession): Task<TotpSecret!>

Creates a TOTP secret as part of enrolling a TOTP (time-based one-time password) second factor. This method uses the auth instance corresponding to the user in theMultiFactorSession.

getAssertionForEnrollment

java-static fun getAssertionForEnrollment(secret: TotpSecret, otp: String): TotpMultiFactorAssertion

Creates an assertion for completing the enrollment flow.

Parameters
secret: TotpSecret

obtained from thegenerateSecret step.

otp: String

one-time password obtained from the TOTP App.

getAssertionForSignIn

java-static fun getAssertionForSignIn(enrollmentId: String, otp: String): TotpMultiFactorAssertion

Creates an assertion for the sign-in flow.

Parameters
enrollmentId: String

identifies the TOTP second factor being used.

otp: String

one-time password obtained from the TOTP App.

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 2025-07-21 UTC.