me-*_*e-- 21 android facebook facebook-authentication firebase firebase-authentication
我在App Store中有一个Android应用。它在后端使用Firebase,并通过Facebook(和Google)提供社交登录。
最近,Facebook联系我,警告我通过Facebook登录时我的应用程序崩溃/无响应。感到困惑,我开始进行一些测试。
我发现,如果我在未安装Facebook应用程序的情况下使用Facebook登录名,则一切运行正常。向用户显示一个浏览器窗口,可以登录,他们被重定向回我的应用程序,并且我具有他们的身份。当然,我在开发过程中发现了所有这些内容,但只是想确认一切仍然正常。
但是,当我安装Facebook应用程序时(在开发过程中我忽略了这一点),我发现它不再起作用。而是,用户被重定向到此页面:
为了便于搜索和访问,该图像中的文字为:
登录错误:将您登录到此应用程序时出错。请稍后再试。
发生这种情况时,我已经检查了日志,发现以下内容可能相关,但我不确定:
07-05 15:36:28.468 908 5828 I ActivityManager: START u0 {act=NATIVE_WITH_FALLBACK cmp=<<redacted>>/com.facebook.FacebookActivity (has extras)} from uid 10264
07-05 15:36:28.469 665 665 D QCOM PowerHAL: LAUNCH HINT: ON
07-05 15:36:28.470 665 665 D QCOM PowerHAL: Activity launch hint handled
07-05 15:36:28.495 4837 4837 W ActivityThread: handleWindowVisibility: no activity for token android.os.BinderProxy@e64bd3e
07-05 15:36:28.689 665 665 D QCOM PowerHAL: LAUNCH HINT: OFF
07-05 15:36:28.946 29406 4941 W fb4a.BlueServiceQueue: Exception during service
07-05 15:36:28.946 29406 4941 W fb4a.BlueServiceQueue: X.2LH: [code] 404 [message]: Key hash GtvUdcOKFRAE0RY0LIw5veCA+M8= does not match any stored key hashes. (404) [extra]: null
07-05 15:36:28.946 29406 4941 W fb4a.BlueServiceQueue: at X.1eL.C(:93)
07-05 15:36:28.946 29406 4941 W fb4a.BlueServiceQueue: at X.2sO.C(:26)
07-05 15:36:28.946 29406 4941 W fb4a.BlueServiceQueue: at X.CvC.umA(:38)
07-05 15:36:28.946 29406 4941 W fb4a.BlueServiceQueue: at X.2yi.handleResponse(:224)
07-05 15:36:28.946 29406 4941 W fb4a.BlueServiceQueue: at X.1dO.run(:71)
07-05 15:36:28.946 29406 4941 W fb4a.BlueServiceQueue: at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:458)
07-05 15:36:28.946 29406 4941 W fb4a.BlueServiceQueue: at X.0r0.run(:2)
07-05 15:36:28.946 29406 4941 W fb4a.BlueServiceQueue: at X.1qG.run(:2)
07-05 15:36:28.946 29406 4941 W fb4a.BlueServiceQueue: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
07-05 15:36:28.946 29406 4941 W fb4a.BlueServiceQueue: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
07-05 15:36:28.946 29406 4941 W fb4a.BlueServiceQueue: at X.12V.run(:3)
07-05 15:36:28.946 29406 4941 W fb4a.BlueServiceQueue: at X.1xB.run(:12)
07-05 15:36:28.946 29406 4941 W fb4a.BlueServiceQueue: at java.lang.Thread.run(Thread.java:764)
07-05 15:36:28.981 908 8581 I ActivityManager: START u0 {cmp=com.facebook.katana/.ProxyAuth (has extras)} from uid 10264
07-05 15:36:28.982 665 665 D QCOM PowerHAL: LAUNCH HINT: ON
07-05 15:36:28.983 665 665 D QCOM PowerHAL: Activity launch hint handled
07-05 15:36:29.022 29406 29406 W ActivityThread: handleWindowVisibility: no activity for token android.os.BinderProxy@4f13a10
07-05 15:36:29.037 29406 29406 E Instrumentation: Uninitialized ActivityThread, likely app-created Instrumentation, disabling AppComponentFactory
07-05 15:36:29.037 29406 29406 E Instrumentation: java.lang.Throwable
07-05 15:36:29.037 29406 29406 E Instrumentation: at android.app.Instrumentation.getFactory(Instrumentation.java:1224)
07-05 15:36:29.037 29406 29406 E Instrumentation: at android.app.Instrumentation.newActivity(Instrumentation.java:1215)
07-05 15:36:29.037 29406 29406 E Instrumentation: at X.05O.newActivity(:3382)
07-05 15:36:29.037 29406 29406 E Instrumentation: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2869)
07-05 15:36:29.037 29406 29406 E Instrumentation: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3086)
07-05 15:36:29.037 29406 29406 E Instrumentation: at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
07-05 15:36:29.037 29406 29406 E Instrumentation: at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
07-05 15:36:29.037 29406 29406 E Instrumentation: at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
07-05 15:36:29.037 29406 29406 E Instrumentation: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1816)
07-05 15:36:29.037 29406 29406 E Instrumentation: at android.os.Handler.dispatchMessage(Handler.java:106)
07-05 15:36:29.037 29406 29406 E Instrumentation: at android.os.Looper.loop(Looper.java:193)
07-05 15:36:29.037 29406 29406 E Instrumentation: at android.app.ActivityThread.main(ActivityThread.java:6718)
07-05 15:36:29.037 29406 29406 E Instrumentation: at java.lang.reflect.Method.invoke(Native Method)
07-05 15:36:29.037 29406 29406 E Instrumentation: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
07-05 15:36:29.037 29406 29406 E Instrumentation: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
07-05 15:36:29.045 908 2933 I ActivityManager: START u0 {flg=0x2000000 cmp=com.facebook.katana/com.facebook.gdp.ProxyAuth (has extras)} from uid 10262
07-05 15:36:29.047 665 665 D QCOM PowerHAL: LAUNCH HINT: ON
07-05 15:36:29.068 29406 29406 W ActivityThread: handleWindowVisibility: no activity for token android.os.BinderProxy@f095b27
07-05 15:36:29.069 29406 29406 E Instrumentation: Uninitialized ActivityThread, likely app-created Instrumentation, disabling AppComponentFactory
07-05 15:36:29.069 29406 29406 E Instrumentation: java.lang.Throwable
07-05 15:36:29.069 29406 29406 E Instrumentation: at android.app.Instrumentation.getFactory(Instrumentation.java:1224)
07-05 15:36:29.069 29406 29406 E Instrumentation: at android.app.Instrumentation.newActivity(Instrumentation.java:1215)
07-05 15:36:29.069 29406 29406 E Instrumentation: at X.05O.newActivity(:3382)
07-05 15:36:29.069 29406 29406 E Instrumentation: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2869)
07-05 15:36:29.069 29406 29406 E Instrumentation: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3086)
07-05 15:36:29.069 29406 29406 E Instrumentation: at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
07-05 15:36:29.069 29406 29406 E Instrumentation: at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
07-05 15:36:29.069 29406 29406 E Instrumentation: at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
07-05 15:36:29.069 29406 29406 E Instrumentation: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1816)
07-05 15:36:29.069 29406 29406 E Instrumentation: at android.os.Handler.dispatchMessage(Handler.java:106)
07-05 15:36:29.069 29406 29406 E Instrumentation: at android.os.Looper.loop(Looper.java:193)
07-05 15:36:29.069 29406 29406 E Instrumentation: at android.app.ActivityThread.main(ActivityThread.java:6718)
07-05 15:36:29.069 29406 29406 E Instrumentation: at java.lang.reflect.Method.invoke(Native Method)
07-05 15:36:29.069 29406 29406 E Instrumentation: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
07-05 15:36:29.069 29406 29406 E Instrumentation: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
07-05 15:36:29.074 908 5828 I ActivityManager: START u0 {cmp=com.facebook.katana/com.facebook.gdp.LightWeightProxyAuthActivity (has extras)} from uid 10262
07-05 15:36:29.075 665 665 D QCOM PowerHAL: LAUNCH HINT: ON
07-05 15:36:29.121 29406 29406 W ActivityThread: handleWindowVisibility: no activity for token android.os.BinderProxy@d695c17
07-05 15:36:29.125 29406 29406 E Instrumentation: Uninitialized ActivityThread, likely app-created Instrumentation, disabling AppComponentFactory
07-05 15:36:29.125 29406 29406 E Instrumentation: java.lang.Throwable
07-05 15:36:29.125 29406 29406 E Instrumentation: at android.app.Instrumentation.getFactory(Instrumentation.java:1224)
07-05 15:36:29.125 29406 29406 E Instrumentation: at android.app.Instrumentation.newActivity(Instrumentation.java:1215)
07-05 15:36:29.125 29406 29406 E Instrumentation: at X.05O.newActivity(:3382)
07-05 15:36:29.125 29406 29406 E Instrumentation: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2869)
07-05 15:36:29.125 29406 29406 E Instrumentation: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3086)
07-05 15:36:29.125 29406 29406 E Instrumentation: at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
07-05 15:36:29.125 29406 29406 E Instrumentation: at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
07-05 15:36:29.125 29406 29406 E Instrumentation: at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
07-05 15:36:29.125 29406 29406 E Instrumentation: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1816)
07-05 15:36:29.125 29406 29406 E Instrumentation: at android.os.Handler.dispatchMessage(Handler.java:106)
07-05 15:36:29.125 29406 29406 E Instrumentation: at android.os.Looper.loop(Looper.java:193)
07-05 15:36:29.125 29406 29406 E Instrumentation: at android.app.ActivityThread.main(ActivityThread.java:6718)
07-05 15:36:29.125 29406 29406 E Instrumentation: at java.lang.reflect.Method.invoke(Native Method)
07-05 15:36:29.125 29406 29406 E Instrumentation: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
07-05 15:36:29.125 29406 29406 E Instrumentation: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
07-05 15:36:29.166 4837 4846 W System : A resource failed to call end.
07-05 15:36:29.250 665 665 D QCOM PowerHAL: LAUNCH HINT: OFF
07-05 15:36:29.266 908 952 I ActivityManager: Displayed com.facebook.katana/com.facebook.gdp.LightWeightProxyAuthActivity: +237ms
07-05 15:36:29.266 29463 29463 W BackgroundBroad: type=1400 audit(0.0:9257): avc: denied { read } for name="stats" dev="proc" ino=4026533031 scontext=u:r:untrusted_app:s0:c6,c257,c512,c768 tcontext=u:object_r:proc_qtaguid_stat:s0 tclass=file permissive=0
07-05 15:36:29.447 492 1273 D SurfaceFlinger: duplicate layer name: changing Surface(name=6e58560 com.facebook.katana/com.facebook.gdp.LightWeightProxyAuthActivity)/@0x13e5ed5 - animation-leash to Surface(name=6e58560 com.facebook.katana/com.facebook.gdp.LightWeightProxyAuthActivity)/@0x13e5ed5 - animation-leash#1
07-05 15:36:29.456 492 1273 D SurfaceFlinger: duplicate layer name: changing Surface(name=Dim Layer for - Task=2317)/@0x8471ddb - animation-leash to Surface(name=Dim Layer for - Task=2317)/@0x8471ddb - animation-leash#1
07-05 15:36:29.465 908 2933 I ActivityManager: START u0 {cmp=com.facebook.katana/.gdp.WebViewProxyAuth (has extras)} from uid 10262
07-05 15:36:29.467 665 665 D QCOM PowerHAL: LAUNCH HINT: ON
07-05 15:36:29.469 665 665 D QCOM PowerHAL: Activity launch hint handled
07-05 15:36:29.507 29406 29406 W ActivityThread: handleWindowVisibility: no activity for token android.os.BinderProxy@a7d9bb4
07-05 15:36:29.509 29406 29406 E Instrumentation: Uninitialized ActivityThread, likely app-created Instrumentation, disabling AppComponentFactory
07-05 15:36:29.509 29406 29406 E Instrumentation: java.lang.Throwable
07-05 15:36:29.509 29406 29406 E Instrumentation: at android.app.Instrumentation.getFactory(Instrumentation.java:1224)
07-05 15:36:29.509 29406 29406 E Instrumentation: at android.app.Instrumentation.newActivity(Instrumentation.java:1215)
07-05 15:36:29.509 29406 29406 E Instrumentation: at X.05O.newActivity(:3382)
07-05 15:36:29.509 29406 29406 E Instrumentation: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2869)
07-05 15:36:29.509 29406 29406 E Instrumentation: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3086)
07-05 15:36:29.509 29406 29406 E Instrumentation: at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
07-05 15:36:29.509 29406 29406 E Instrumentation: at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
07-05 15:36:29.509 29406 29406 E Instrumentation: at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
07-05 15:36:29.509 29406 29406 E Instrumentation: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1816)
07-05 15:36:29.509 29406 29406 E Instrumentation: at android.os.Handler.dispatchMessage(Handler.java:106)
07-05 15:36:29.509 29406 29406 E Instrumentation: at android.os.Looper.loop(Looper.java:193)
07-05 15:36:29.509 29406 29406 E Instrumentation: at android.app.ActivityThread.main(ActivityThread.java:6718)
07-05 15:36:29.509 29406 29406 E Instrumentation: at java.lang.reflect.Method.invoke(Native Method)
07-05 15:36:29.509 29406 29406 E Instrumentation: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
07-05 15:36:29.509 29406 29406 E Instrumentation: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
07-05 15:36:29.517 908 8581 I ActivityManager: START u0 {cmp=com.facebook.katana/.gdp.ProxyAuthDialog (has extras)} from uid 10262
07-05 15:36:29.519 665 665 D QCOM PowerHAL: LAUNCH HINT: ON
07-05 15:36:29.567 29406 29406 W ActivityThread: handleWindowVisibility: no activity for token android.os.BinderProxy@19959e4
07-05 15:36:29.569 29406 29406 E Instrumentation: Uninitialized ActivityThread, likely app-created Instrumentation, disabling AppComponentFactory
07-05 15:36:29.569 29406 29406 E Instrumentation: java.lang.Throwable
07-05 15:36:29.569 29406 29406 E Instrumentation: at android.app.Instrumentation.getFactory(Instrumentation.java:1224)
07-05 15:36:29.569 29406 29406 E Instrumentation: at android.app.Instrumentation.newActivity(Instrumentation.java:1215)
07-05 15:36:29.569 29406 29406 E Instrumentation: at X.05O.newActivity(:3382)
07-05 15:36:29.569 29406 29406 E Instrumentation: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2869)
07-05 15:36:29.569 29406 29406 E Instrumentation: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3086)
07-05 15:36:29.569 29406 29406 E Instrumentation: at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
07-05 15:36:29.569 29406 29406 E Instrumentation: at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
07-05 15:36:29.569 29406 29406 E Instrumentation: at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
07-05 15:36:29.569 29406 29406 E Instrumentation: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1816)
07-05 15:36:29.569 29406 29406 E Instrumentation: at android.os.Handler.dispatchMessage(Handler.java:106)
07-05 15:36:29.569 29406 29406 E Instrumentation: at android.os.Looper.loop(Looper.java:193)
07-05 15:36:29.569 29406 29406 E Instrumentation: at android.app.ActivityThread.main(ActivityThread.java:6718)
07-05 15:36:29.569 29406 29406 E Instrumentation: at java.lang.reflect.Method.invoke(Native Method)
07-05 15:36:29.569 29406 29406 E Instrumentation: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
07-05 15:36:29.569 29406 29406 E Instrumentation: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
07-05 15:36:29.651 492 540 D SurfaceFlinger: duplicate layer name: changing com.facebook.katana/com.facebook.katana.gdp.ProxyAuthDialog to com.facebook.katana/com.facebook.katana.gdp.ProxyAuthDialog#1
07-05 15:36:29.697 492 1763 D SurfaceFlinger: duplicate layer name: changing Dim Layer for - Task=2317 to Dim Layer for - Task=2317#1
07-05 15:36:29.720 665 665 D QCOM PowerHAL: LAUNCH HINT: OFF
07-05 15:36:29.731 492 540 W SurfaceFlinger: Attempting to set client state on removed layer: Dim Layer for - Task=2317#0
07-05 15:36:29.731 492 540 W SurfaceFlinger: Attempting to destroy on removed layer: Dim Layer for - Task=2317#0
Run Code Online (Sandbox Code Playgroud)
我注意到使用NATIVE_WITH_FALLBACK
模式,并更改WEB_ONLY
为测试。尽管这使我摆脱了上图所示的原始问题,但它又产生了另一个问题。它没有询问我登录详细信息,而是显示了以下内容:
同样,文字是:
您先前使用Facebook登录到$ MY_APP。你想继续吗?
如果我选择继续(别无选择,只能取消),它会返回我的应用程序,但是Firebase会给我ERROR_ACCOUNT_EXISTS_WITH_DIFFERENT_CREDENTIAL
错误,提示该帐户已与另一个提供程序关联。当我在Firebase控制台中签入时,该帐户显示为Facebook帐户。因此,就像安装了Facebook应用程序一样,Firebase认为它是单独的社交服务提供商或其他某种服务。
最后,出于绝望,我尝试将身份验证模式切换为WEB_VIEW_ONLY
。果然,这向我展示了与未安装Facebook时登录完全相同的体验。而且,一切都按预期进行。
我的问题是我不确定所有这些含义是什么(注意:请参阅下面的更新)。我记得曾经读过一些有关本地Facebook登录的信息,但不再是真的(或者相反,应该使用它)。基本上,我很困惑,非常感谢您回答以下问题:
WEB_VIEW_ONLY
可接受的方法吗?NATIVE_WITH_FALLBACK
会在帖子开头显示错误?WEB_ONLY
似乎会将同一帐户视为不同的提供商?请注意,在所有情况下,我都会使用官方文档,包括使用最新的SDK版本:
implementation 'com.facebook.android:facebook-login:[5,6)'
Run Code Online (Sandbox Code Playgroud)
感谢您的协助。
更新:我将我的应用程序更新为,WEB_VIEW_ONLY
然后重新提交。Facebook现在告诉我:
您的应用现在违反了平台政策8.2:实现Facebook登录的本机iOS和Android应用必须使用我们的官方SDK进行登录。请确保您的应用使用的是我们最新版的SDK进行登录。
所以我现在陷入了困境。
这是这个问题的解释:
\n\n\n\n\n07-05 15:36:28.946 29406 4941 W fb4a.BlueServiceQueue: 服务期间出现异常\n 07-05 15:36:28.946 29406 4941 W fb4a.BlueServiceQueue:\n X.2LH: [代码] 404 [消息]: 密钥hash GtvUdcOKFRAE0RY0LIw5veCA+M8=\n 与任何存储的密钥哈希值不匹配。(404)[额外]:空
\n
请记住,您在 Facebook 应用程序中配置的密钥哈希与您的应用程序签名的密钥库(证书)相关。
\n\n\n\n您必须使用用于签署应用程序的密钥哈希,如果您不知道它,我建议您从密钥库中再次获取它:
\n\nhttps://developers.facebook.com/docs/android/getting-started/
\n\n\n\n\n为什么 Facebook 登录 SDK 在这些模式下的表现如此不同?我认为它们是一种无害的偏好,对身份验证本身没有任何影响,但天哪我错了。
\n
在网络中,你不会\xc2\xb4t有问题,但如果你在一个应用程序中,你需要授权该应用程序的使用,这对于Android应用程序中的这个实现非常重要,你需要使用Facebook SDK,在这种情况下您需要获取用于签署您的应用程序的密钥哈希证书。
\n在你的日志顶部,它说
Key hash GtvUdcOKFRAE0RY0LIw5veCA+M8= does not match any stored key hashes.
当您构建发布时,您可能使用了错误的 keyhash。显然,当您使用错误的 keyhash(如本链接中所述)时,就会发生此问题。
至于为什么它在WEB模式下工作,是因为SDK检查了keyhash,并且由于您改为访问网页,因此您不会收到错误。您正在调试模式下运行,并且调试模式密钥哈希可能是正确的,这可能是它在您的设备上工作的原因的答案。
归档时间: |
|
查看次数: |
566 次 |
最近记录: |