Migrate your iOS App from Digits to Firebase

If you use Digits to sign in users with their phone numbers, you should migrate your app to Firebase Authentication. All future development of the phone number sign-in feature will happen in Firebase, and on September 30, 2017 Digits will be shut down.

By following the instructions on this page, you can migrate your app from Digits to Firebase, without disrupting your current Digits users.


To migrate your app from Digits to Firebase Authentication, complete these steps:

  1. Migrate your Digits user accounts to Firebase
  2. Replace the Digits SDK with the Firebase SDK
  3. Migrate active Digits sessions to Firebase

The first step can be completed immediately without affecting your app or existing users; the remaining steps should be completed at the same time.

Migrate your Digits user accounts to Firebase

First, migrate your Digits user accounts to Firebase as described in the Fabric developer docs.

After you complete the account migration steps, you will have a Firebase project that contains all of your Digits user accounts. In addition, any Digits accounts created after enabling migration will be automatically migrated to Firebase.

Replace the Digits SDK with the Firebase SDK

Next, in your app, replace the calls to the Digits SDK with calls to the Firebase SDK.

If you use the pre-configured Digits sign-in button, DGTAuthenticateButton, you can switch to Firebase by doing one of the following:

  • Install FirebaseUI and replace the DGTAuthenticateButton's parent view with the authViewController from FirebaseUI.
  • Set up the Firebase SDK to use phone number sign-in. Then, replace DGTAuthenticateButton with a UIButton. When the user presses the UIButton, call verifyPhoneNumber:completion:.

If you use a custom button that calls the Digits SDK's authenticateWithCompletion: method, set up the Firebase SDK to use phone number sign-in. Then, replace the call to authenticateWithCompletion: with the Firebase SDK's verifyPhoneNumber:completion: method.

After you replace Digits with Firebase, remove the Digits SDK from your Podfile and build configuration.

Migrate active Digits sessions to Firebase

Finally, migrate any active user sessions from Digits to Firebase so that your users do not have to sign in again after you deploy your updated app.

To migrate your Digits sessions to Firebase sessions, use the Digits Migration Helper SDK to generate a Firebase authentication token from the active Digits session. Then, use the token to sign in with Firebase. Finally, after successfully signing in using Firebase, clear the Digits session.

  1. Add the Digits Migration Helper SDK to your Podfile:
    pod 'DigitsMigrationHelper'
    Then, run the pod install command.
  2. When your app loads, check for an active Digits session, and if one exists, convert it to a Firebase session. Then, clear the Digits session with clearLegacyAuth:. For example:


    let migrator = DigitsMigrator.init(digitsAppConsumerKey: key as! String, withDigitsAppConsumerSecret: secret as! String)
    migrator.getLegacyAuth { (customSignInToken, session) in
      if let customSignInToken = customSignInToken {
        print("Legacy digits session detected: token=\(customSignInToken), session=\(DigitsSession.describe(session))")
        Auth.auth().signIn(withCustomToken: customSignInToken) { (user, error) in
          if let error = error {
            print("signInWithCustomToken, user=\(String(describing: user)), error=\(error)")
          migrator.clearLegacyAuth { (success, error) in
            print("clearLegacyAuth, success=\(success), error=\(error?.localizedDescription ?? "")")


    FIRDigitsMigrator *migrator = [[FIRDigitsMigrator alloc] initWithDigitsAppConsumerKey:key
    [migrator getLegacyAuth:^(NSString *customSignInToken, FIRDigitsSession *session){
      if (customSignInToken) {
        NSLog(@"Legacy digits session detected: token=%@, session=%@", customSignInToken, [FIRDigitsSession describe:session]);
        [[FIRAuth auth] signInWithCustomToken:customSignInToken
                                   completion:^(FIRUser * _Nullable user, NSError * _Nullable error) {
          NSLog(@"signInWithCustomToken, user=%@, error=%@", user, error);
          if (!error) {
            NSString *msg = [NSString stringWithFormat:@"Converted to firebase user with id as %@", user.uid];
            [migrator clearLegacyAuth:^(BOOL success, NSError * _Nullable error){
              NSLog(@"clearLegacyAuth, success=%d, error=%@", success, error);
      } else {
        NSLog(@"No legacy digits session detected");
        // ...

    You can do this conversion wherever is convenient for your app; often, this is in your AppDelegate.

    If getLegacyAuth: doesn't produce a custom token, the user isn't signed in with Digits and you can continue to sign in with Firebase.

  3. Optional: Record that the Digits session has been migrated, and conditionally skip the previous step if it has already been completed.

Send feedback about...

Need help? Visit our support page.