devsite/tools/jazzy/templates

FirebaseAuth Framework Reference

TOTPMultiFactorGenerator

@available(iOS 13, tvOS 13, macOS 10.15, watchOS 7, *)
@objc(FIRTOTPMultiFactorGenerator)
open class TOTPMultiFactorGenerator : NSObject

The data structure used to help initialize an assertion for a second factor entity to the Firebase Auth/CICP server. Depending on the type of second factor, this will help generate the assertion.

This class is available on iOS only.

  • 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.

    Declaration

    Swift

    @objc(generateSecretWithMultiFactorSession:completion:)
    open class func generateSecret(with session: MultiFactorSession,
                                   completion: @escaping (TOTPSecret?, Error?) -> Void)

    Parameters

    session

    The multiFactorSession instance.

    completion

    Completion block

  • 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 correspondingto the user in the multiFactorSession.

    Declaration

    Swift

    @available(iOS 13, tvOS 13, macOS 10.15, watchOS 7, *)
    open class func generateSecret(with session: MultiFactorSession) async throws -> TOTPSecret

    Parameters

    session

    The multiFactorSession instance.

    Return Value

    The TOTP secret.

  • Initializes the MFA assertion to confirm ownership of the TOTP second factor.

    This assertion is used to complete enrollment of TOTP as a second factor.

    Declaration

    Swift

    @objc(assertionForEnrollmentWithSecret:oneTimePassword:)
    open class func assertionForEnrollment(with secret: TOTPSecret,
                                           oneTimePassword: String) -> TOTPMultiFactorAssertion

    Parameters

    secret

    The TOTP secret.

    oneTimePassword

    One time password string.

    Return Value

    The MFA assertion.

  • Initializes the MFA assertion to confirm ownership of the TOTP second factor.

    This assertion is used to complete signIn with TOTP as a second factor.

    Declaration

    Swift

    @objc(assertionForSignInWithEnrollmentID:oneTimePassword:)
    open class func assertionForSignIn(withEnrollmentID enrollmentID: String,
                                       oneTimePassword: String) -> TOTPMultiFactorAssertion

    Parameters

    enrollmentID

    The ID that identifies the enrolled TOTP second factor.

    oneTimePassword

    one time password string.

    Return Value

    The MFA assertion.

The Firebase JavaScript SDK implements the client-side libraries for applications using Firebase services.

Updated Jul 22, 2022

See upcoming events and explore all the great content from past events

Updated Oct 3, 2024

Firebase Authentication lets you add an end-to-end identity solution to your app for easy user authentication, sign-in, and onboarding in just a few lines of code.

Updated Feb 21, 2025