FirebaseUI Auth库:谷歌登录失败:W/AuthMethodPicker: Firebase登录失败

时间:2022-05-20 20:56:20

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.

使用可用的在线文档和本视频:https://www.youtube.com/watch?v=0ucjYG_JrEE,我正在尝试应用新的UI Auth库。Mail sign in works great,谷歌sign in not:它给出一个警告,UI继续显示“load…”对话框。

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.

更多的日志输出将会很有帮助。注意,这只发生在一个导入的Firebase项目上,而不是在一个新创建的Firebase项目上。

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.

2 个解决方案

#1


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!

刚刚找到了这个问题的原因:我的应用程序使用了一个意想不到的(错误的)调试。用于调试APK的密钥存储库…在指向正确的调试之后。在我的构建中,密钥存储库一切工作正常!

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

(答案为感谢此线程:Android Studio - debug keystore)

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

感谢谷歌/Firebase团队交付UI Auth解决方案:这是一个很大的改进!

#2


1  

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

对于任何在发布版本中获得这个的人。确保在您的Firebase项目设置中有正确的SHA1指纹。

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

以下是正确的指纹:https://developers.google.com/android/guides/client-auth

#1


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!

刚刚找到了这个问题的原因:我的应用程序使用了一个意想不到的(错误的)调试。用于调试APK的密钥存储库…在指向正确的调试之后。在我的构建中,密钥存储库一切工作正常!

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

(答案为感谢此线程:Android Studio - debug keystore)

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

感谢谷歌/Firebase团队交付UI Auth解决方案:这是一个很大的改进!

#2


1  

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

对于任何在发布版本中获得这个的人。确保在您的Firebase项目设置中有正确的SHA1指纹。

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

以下是正确的指纹:https://developers.google.com/android/guides/client-auth