Firebaseui-android: Phone auth - the custom token corresponds to a different audience

Created on 17 Jun 2017  路  8Comments  路  Source: firebase/FirebaseUI-Android

Greetings, I have implemented the new phone authentication feature and followed all of the required steps. However, after I submit my phone number I receive a dialog with the following message "The custom token corresponds to a different audience". Any help would be greatly appreciated as I intend on migrating from digits asap.

auth bug

Most helpful comment

I had a same issue. I had to add SHA-1 hash to project settings. You can obtain debug hash for example by execute: keytool -list -v -keystore .android/debug.keystore in your user directory.

All 8 comments

@vladgheorghe are you seeing this with FirebaseUI or when implementing phone authentication yourself? Can you show me a screenshot?

@samtstern with FirebaseUI, I have enabled phone auth on firebase console and also checked project settings and google-service.json

gradle

    compile 'com.google.firebase:firebase-core:11.0.1'
    compile 'com.google.firebase:firebase-messaging:11.0.1'
    compile 'com.google.firebase:firebase-auth:11.0.1'
    compile 'com.firebaseui:firebase-ui-auth:2.0.1'

manifest

<service
            android:name=".networking.push.FirebaseIDService">
            <intent-filter>
                <action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
            </intent-filter>
        </service>

        <service
            android:name=".networking.push.FirebaseService">
            <intent-filter>
                <action android:name="com.google.firebase.MESSAGING_EVENT"/>
            </intent-filter>
        </service>

        <meta-data
            android:name="com.facebook.sdk.ApplicationId"
            android:value="@string/facebook_app_id"
            tools:replace="android:value"/>

        <meta-data
            android:name="io.fabric.ApiKey"
            android:value="hidden_for_this_comment"
            tools:replace="android:value"/>

        <meta-data
            android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version" />

code

  startActivityForResult(
                            AuthUI.getInstance()
                                    .createSignInIntentBuilder()
                                    .setProviders(Arrays.asList(
                                            new AuthUI.IdpConfig.Builder(AuthUI.PHONE_VERIFICATION_PROVIDER).build()
                                    ))
                                    .setTheme(R.style.DigitsTheme)
                                    .build(),
                            FIREBASE_SIGN_IN);

device-2017-06-17-021453

cc @ashwinraghav any idea about this error message?

I had a same issue. I had to add SHA-1 hash to project settings. You can obtain debug hash for example by execute: keytool -list -v -keystore .android/debug.keystore in your user directory.

@bareq thanks for pointing that out. @vladgheorghe have you added a SHA1 for your app in the Firebase console?

Facing the same issue. SHA-1 hash has been added to project settings.

same issue here, I am implementing phone authentication myself on android.

In FirebaseUI 2.1.0 we updated the error message for this to be clearer. The backend team has informed me that this error should only come from a developer configuration issue such as incorrect SHA1 or an API key from a different project.

The backend team has also promised to start returning better error messages for this in the future. In the meantime if you are stuck on this issue please contact Firebase Support who can better help debug (they can dig into your project config).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

s-p-a-r-k picture s-p-a-r-k  路  5Comments

akrmn picture akrmn  路  4Comments

hendrep picture hendrep  路  3Comments

pedrodanielcsantos picture pedrodanielcsantos  路  4Comments

joknu1 picture joknu1  路  4Comments