FirebaseAuth Framework Reference
Stay organized with collections
Save and categorize content based on your preferences.
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 and macOS.
-
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
|
|
-
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
|
|
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.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-27 UTC.
[null,null,["Last updated 2025-08-27 UTC."],[],[],null,["# FirebaseAuth Framework Reference\n\nTOTPMultiFactorGenerator\n========================\n\n @available(iOS 13, tvOS 13, macOS 10.15, watchOS 7, *)\n @objc(FIRTOTPMultiFactorGenerator)\n open class TOTPMultiFactorGenerator : NSObject\n\nThe data structure used to help initialize an assertion for a second factor entity to the\nFirebase Auth/CICP server. Depending on the type of second factor, this will help generate\nthe assertion.\n\nThis class is available on iOS only.\n- `\n ``\n ``\n `\n\n ### [generateSecret(with:completion:)](#/c:@M@FirebaseAuth@objc(cs)FIRTOTPMultiFactorGenerator(cm)generateSecretWithMultiFactorSession:completion:)\n\n `\n ` \n Creates a TOTP secret as part of enrolling a TOTP second factor. Used for generating a\n QR code URL or inputting into a TOTP app. This method uses the auth instance corresponding\n to the user in the multiFactorSession. \n\n #### Declaration\n\n Swift \n\n @objc(generateSecretWithMultiFactorSession:completion:)\n open class func generateSecret(with session: ../Classes.html#/c:@M@FirebaseAuth@objc(cs)FIRMultiFactorSession,\n completion: @escaping (../Classes/TOTPSecret.html?, Error?) -\u003e Void)\n\n #### Parameters\n\n |--------------------|----------------------------------|\n | ` `*session*` ` | The multiFactorSession instance. |\n | ` `*completion*` ` | Completion block |\n\n- `\n ``\n ``\n `\n\n ### [generateSecret(with:)](#/s:12FirebaseAuth24TOTPMultiFactorGeneratorC14generateSecret4withAA10TOTPSecretCAA05MultiD7SessionC_tYaKFZ)\n\n `\n ` \n Creates a TOTP secret as part of enrolling a TOTP second factor.\n\n Used for generating a QR code URL or inputting into a TOTP app. This\n method uses the auth instance correspondingto the user in the multiFactorSession. \n\n #### Declaration\n\n Swift \n\n @available(iOS 13, tvOS 13, macOS 10.15, watchOS 7, *)\n open class func generateSecret(with session: ../Classes.html#/c:@M@FirebaseAuth@objc(cs)FIRMultiFactorSession) async throws -\u003e ../Classes/TOTPSecret.html\n\n #### Parameters\n\n |-----------------|----------------------------------|\n | ` `*session*` ` | The multiFactorSession instance. |\n\n #### Return Value\n\n The TOTP secret.\n- `\n ``\n ``\n `\n\n ### [assertionForEnrollment(with:oneTimePassword:)](#/c:@M@FirebaseAuth@objc(cs)FIRTOTPMultiFactorGenerator(cm)assertionForEnrollmentWithSecret:oneTimePassword:)\n\n `\n ` \n Initializes the MFA assertion to confirm ownership of the TOTP second factor.\n\n This assertion is used to complete enrollment of TOTP as a second factor. \n\n #### Declaration\n\n Swift \n\n @objc(assertionForEnrollmentWithSecret:oneTimePassword:)\n open class func assertionForEnrollment(with secret: ../Classes/TOTPSecret.html,\n oneTimePassword: String) -\u003e ../Classes.html#/c:@M@FirebaseAuth@objc(cs)FIRTOTPMultiFactorAssertion\n\n #### Parameters\n\n |-------------------------|---------------------------|\n | ` `*secret*` ` | The TOTP secret. |\n | ` `*oneTimePassword*` ` | One time password string. |\n\n #### Return Value\n\n The MFA assertion.\n- `\n ``\n ``\n `\n\n ### [assertionForSignIn(withEnrollmentID:oneTimePassword:)](#/c:@M@FirebaseAuth@objc(cs)FIRTOTPMultiFactorGenerator(cm)assertionForSignInWithEnrollmentID:oneTimePassword:)\n\n `\n ` \n Initializes the MFA assertion to confirm ownership of the TOTP second factor.\n\n This assertion is used to complete signIn with TOTP as a second factor. \n\n #### Declaration\n\n Swift \n\n @objc(assertionForSignInWithEnrollmentID:oneTimePassword:)\n open class func assertionForSignIn(withEnrollmentID enrollmentID: String,\n oneTimePassword: String) -\u003e ../Classes.html#/c:@M@FirebaseAuth@objc(cs)FIRTOTPMultiFactorAssertion\n\n #### Parameters\n\n |-------------------------|---------------------------------------------------------|\n | ` `*enrollmentID*` ` | The ID that identifies the enrolled TOTP second factor. |\n | ` `*oneTimePassword*` ` | one time password string. |\n\n #### Return Value\n\n The MFA assertion."]]