com.firebase.ui.auth.FirebaseUiException:提供程序错误 - Firebase-UI 身份验证 Facebook 登录不起作用
Posted
技术标签:
【中文标题】com.firebase.ui.auth.FirebaseUiException:提供程序错误 - Firebase-UI 身份验证 Facebook 登录不起作用【英文标题】:com.firebase.ui.auth.FirebaseUiException: Provider error - Firebase-UI Authentication Facebook login not working 【发布时间】:2018-12-24 00:02:16 【问题描述】:我正在通过电子邮件、facebook 和 google 提供商使用 Firebase-UI 身份验证。电子邮件和 Google 登录工作正常,但 Facebook 登录不工作。
我的 facebook 和 firebase 依赖项:
//Firebase
implementation 'com.google.firebase:firebase-core:16.0.1'
//Cloud Firestore
implementation 'com.google.firebase:firebase-firestore:17.0.2'
//Firebase Authentication
implementation 'com.google.firebase:firebase-auth:16.0.2'
//Firebase built-in Auth UI
implementation 'com.firebaseui:firebase-ui-auth:4.0.0'
//Firebase Storage
implementation 'com.google.firebase:firebase-storage:16.0.1'
// Required only if Facebook login support is required
implementation 'com.facebook.android:facebook-android-sdk:4.34.0'
//Google sign-in with Firebase Authentication
implementation 'com.google.android.gms:play-services-auth:15.0.1'
必要的 facebook 字符串:
<string name="facebook_application_id" translatable="false">#######</string>
<string name="facebook_login_protocol_scheme" translatable="false">fb#######</string>
在我的活动中,我有:
void signIn()
AuthUI.IdpConfig facebookIdpConfig = new AuthUI.IdpConfig.FacebookBuilder()
.setPermissions(Arrays.asList("user_friends"))
.build();
List<AuthUI.IdpConfig> providers = Arrays.asList(
new AuthUI.IdpConfig.EmailBuilder().build(),
new AuthUI.IdpConfig.GoogleBuilder().build(),
facebookIdpConfig);
startActivityForResult(
AuthUI.getInstance().createSignInIntentBuilder()
.setTheme(AuthUI.getDefaultTheme())
.setLogo(R.drawable.com_facebook_button_login_logo)
.setAvailableProviders(providers)
.build(),
RC_SIGN_IN);
在点击 Facebook 登录按钮之前: Sign in buttons
点击 Facebook 登录按钮后: Error page after clicking button
关闭Facebook错误页面后的错误日志:
07-16 14:23:43.480 27301-27301/com.example E/AuthUI: A sign-in error occurred.
com.firebase.ui.auth.FirebaseUiException: Provider error
at com.firebase.ui.auth.data.remote.FacebookSignInHandler$Callback.onError(FacebookSignInHandler.java:117)
at com.firebase.ui.auth.data.remote.FacebookSignInHandler$Callback.onCancel(FacebookSignInHandler.java:112)
at com.facebook.login.LoginManager.finishLogin(LoginManager.java:654)
at com.facebook.login.LoginManager.onActivityResult(LoginManager.java:245)
at com.facebook.login.LoginManager$1.onActivityResult(LoginManager.java:174)
at com.facebook.internal.CallbackManagerImpl.onActivityResult(CallbackManagerImpl.java:95)
at com.firebase.ui.auth.data.remote.FacebookSignInHandler.onActivityResult(FacebookSignInHandler.java:87)
at com.firebase.ui.auth.ui.idp.AuthMethodPickerActivity.onActivityResult(AuthMethodPickerActivity.java:225)
at android.app.Activity.dispatchActivityResult(Activity.java:5563)
at android.app.ActivityThread.deliverResults(ActivityThread.java:3496)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:3543)
at android.app.ActivityThread.access$1200(ActivityThread.java:159)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1364)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:176)
at android.app.ActivityThread.main(ActivityThread.java:5419)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1046)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:862)
at dalvik.system.NativeStart.main(Native Method)
Caused by: null
at com.firebase.ui.auth.data.remote.FacebookSignInHandler$Callback.onCancel(FacebookSignInHandler.java:112)
at com.facebook.login.LoginManager.finishLogin(LoginManager.java:654)
at com.facebook.login.LoginManager.onActivityResult(LoginManager.java:245)
at com.facebook.login.LoginManager$1.onActivityResult(LoginManager.java:174)
at com.facebook.internal.CallbackManagerImpl.onActivityResult(CallbackManagerImpl.java:95)
at com.firebase.ui.auth.data.remote.FacebookSignInHandler.onActivityResult(FacebookSignInHandler.java:87)
at com.firebase.ui.auth.ui.idp.AuthMethodPickerActivity.onActivityResult(AuthMethodPickerActivity.java:225)
at android.app.Activity.dispatchActivityResult(Activity.java:5563)
at android.app.ActivityThread.deliverResults(ActivityThread.java:3496)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:3543)
at android.app.ActivityThread.access$1200(ActivityThread.java:159)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1364)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:176)
at android.app.ActivityThread.main(ActivityThread.java:5419)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1046)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:862)
at dalvik.system.NativeStart.main(Native Method)
07-16 14:23:43.485 27301-27301/com.gamifymykid.gamifymykid E/AuthUI: A sign-in error occurred.
com.firebase.ui.auth.FirebaseUiException: Provider error
at com.firebase.ui.auth.data.remote.FacebookSignInHandler$Callback.onError(FacebookSignInHandler.java:117)
at com.firebase.ui.auth.data.remote.FacebookSignInHandler$Callback.onCancel(FacebookSignInHandler.java:112)
at com.facebook.login.LoginManager.finishLogin(LoginManager.java:654)
at com.facebook.login.LoginManager.onActivityResult(LoginManager.java:245)
at com.facebook.login.LoginManager$1.onActivityResult(LoginManager.java:174)
at com.facebook.internal.CallbackManagerImpl.onActivityResult(CallbackManagerImpl.java:95)
at com.firebase.ui.auth.data.remote.FacebookSignInHandler.onActivityResult(FacebookSignInHandler.java:87)
at com.firebase.ui.auth.ui.idp.AuthMethodPickerActivity.onActivityResult(AuthMethodPickerActivity.java:225)
at android.app.Activity.dispatchActivityResult(Activity.java:5563)
at android.app.ActivityThread.deliverResults(ActivityThread.java:3496)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:3543)
at android.app.ActivityThread.access$1200(ActivityThread.java:159)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1364)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:176)
at android.app.ActivityThread.main(ActivityThread.java:5419)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1046)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:862)
at dalvik.system.NativeStart.main(Native Method)
我搜索了其他与我有类似问题的问题,但他们的答案并没有解决我的问题。
提前谢谢你!
【问题讨论】:
FirebaseUI authentication with Facebook not working的可能重复 【参考方案1】:当你使用这个命令时
keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore | openssl sha1 -binary | openssl base64
要获取您在 facebook 配置中输入的密钥哈希,它会要求您输入密码,请确保输入 android
作为密码。
【讨论】:
我不认为配置有什么问题,它适用于更高级别的 Android API 您必须使用“android”作为密码...我试图使用其他一些个人密码,但它不起作用。谢谢,它对我有用。 已经这样做了..但它给出了这样的错误com.firebase.ui.auth.FirebaseUiException: Developer error
【参考方案2】:
您是否在 firebase 中启用了 facebook 登录?
检查您的应用 ID 和应用密钥是否与 developer.facebook.com 相同
在 developer.facebook.com 中转到您的应用,然后设置->基本 检查 App Id 和 App Secret 是否与 firebase 中的 facebook SignIn 相同
另外,别忘了在 Facebook 开发者页面的应用中添加 outh Url
【讨论】:
以上是关于com.firebase.ui.auth.FirebaseUiException:提供程序错误 - Firebase-UI 身份验证 Facebook 登录不起作用的主要内容,如果未能解决你的问题,请参考以下文章