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