FirebaseUI Auth库:Google登录失败:W / AuthMethodPicker:Firebase登录失败 [英] FirebaseUI Auth library: Google sign in fails with: W/AuthMethodPicker: Firebase login unsuccessful

查看:957
本文介绍了FirebaseUI Auth库:Google登录失败:W / AuthMethodPicker:Firebase登录失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用可用的在线文档和此视频: https://www.youtube.com/watch ?v = 0ucjYG_JrEE ,我试图开始应用新的UI Auth库。邮件登录效果很好,Google登录不了:它会发出警告,用户界面不断显示加载...对话框。

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

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

startActivityForResult ($ AuthUI.getInstance()。createSignInIntentBuilder()
.setTheme ).build(),RC_SIGN_IN);


}
}
});

输出:

  05-21 13:49:33.595 25005-25005 / com.xxx.xxx W / AuthMethodPicker:Firebase登录失败

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


$ b

更新:刚刚在控制台中发现了这一点:$ b​​
$ b

  05-22 14:29:58.178 10075-10310 /? V / BaseAuthAsyncOperation:访问令牌请求成功
05-22 14:29:58.179 10075-10310 /? V / AuthAccountOperation:请求标识令牌。
05-22 14:29:58.758 10075-10310 /? E / TokenRequestor:您有错误的OAuth2相关配置,请检查。详细错误:INVALID_AUDIENCE
05-22 14:29:58.758 10075-10310 /? D / AuthAccountOperation:id令牌请求失败。


解决方案

刚发现这个问题的原因:一个意想不到的(错误的)debug.keystore签署的调试APK ...指向正确的debug.keystore内我的建设一切都按预期工作!



(Answer发现感谢这个线程: Android Studio - 调试密钥库

感谢Google / Firebase团队提供UI Auth解决方案:这是一个很大的改进!


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!

这篇关于FirebaseUI Auth库:Google登录失败:W / AuthMethodPicker:Firebase登录失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆