3

Using the available online documentation and this video: https://www.youtube.com/watch?v=0ucjYG_JrEE, I'm trying to start apply the new UI Auth library. Mail sign in works great, the Google sign in not: it gives a warning and the UI keeps showing the "Loading..." dialog.

final FirebaseAuth auth = FirebaseAuth.getInstance();
        auth.addAuthStateListener(new FirebaseAuth.AuthStateListener() {
            @Override
            public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
                FirebaseUser usr = firebaseAuth.getCurrentUser();

                if (usr != null){
                    Log.d( TAG, "User signed in correctly: " + usr );
                    auth.removeAuthStateListener( this );
                } else {
                    //signed out
                    Log.d( TAG, "User is not signed in" );
                    auth.removeAuthStateListener( this );

                    startActivityForResult( AuthUI.getInstance().createSignInIntentBuilder()
                            .setTheme( R.style.AppBaseTheme )
                            .setProviders(
                                    AuthUI.EMAIL_PROVIDER,
                                    AuthUI.GOOGLE_PROVIDER
                            ).build(), RC_SIGN_IN );


                }
            }
        });

Output:

05-21 13:49:33.595 25005-25005/com.xxx.xxx W/AuthMethodPicker: Firebase login unsuccessful

More log output would be helpful. Note that this only happen on a imported Firebase project, not on a newly created Firebase project.

UPDATE: just discovered this in the console:

05-22 14:29:58.178 10075-10310/? V/BaseAuthAsyncOperation: access token request successful
05-22 14:29:58.179 10075-10310/? V/AuthAccountOperation: id token is requested.
05-22 14:29:58.758 10075-10310/? E/TokenRequestor: You have wrong OAuth2 related configurations, please check. Detailed error: INVALID_AUDIENCE
05-22 14:29:58.758 10075-10310/? D/AuthAccountOperation: id token request failed.
Peter
  • 10,910
  • 3
  • 35
  • 68
  • Check this http://stackoverflow.com/questions/37328890/android-firebase-dynamitemodule-failed-to-load-module-descriptor – stevyhacker May 21 '16 at 18:50
  • Thanks for your comment, I have checked this question thread but it does not seem to be related to my issue: I do have sign in working using the same development environment and the same test device using a (newly created) app. My issue seems to be related to configuration, I found this error in the log console: You have wrong OAuth2 related configurations, please check. Detailed error: INVALID_AUDIENCE – Peter May 22 '16 at 12:32

2 Answers2

4

Just found the cause of this issue: my app used an unexpected (wrong) debug.keystore for signing of the debug APK... after pointing to the correct debug.keystore within my build everything works as expected!

(Answer found thank to this thread: Android Studio - debug keystore)

P.s. Thanks to the Google/Firebase team for delivering the UI Auth solution: this is a great improvement!

Community
  • 1
  • 1
Peter
  • 10,910
  • 3
  • 35
  • 68
1

For anyone getting this on a release build. Make sure you have a correct SHA1 fingerprint in your Firebase project settings.

Note that debug and release keystores have different fingerprints.

Here's how you get the correct fingerprint: https://developers.google.com/android/guides/client-auth