SSO(辛格登录)时,Facebook的应用程序安装在设备无​​法正常工作应用程序、正常、设备、工作

2023-09-03 21:36:40 作者:神明

我开发一个Android应用程序,与Facebook整合。该应用程序工作完全正常,当我设置LoginButton.setLoginBehavior(SessionLoginBehavior.SUP preSS_SSO)。

当我尝试使用SSO的问题就出现了。我得到下面的错误。我曾经得到一个类似的错误,当我用了不正确的keyhash;这是不是这样了,因为web视图登录工作正常。什么是事件更令人惊讶的是,如果应用程序被安装在FB中的Andr​​oid应用程序的工作原理。例如,我的应用程序管理器,因此它被安装在默认情况下,我的Facebook个人资料,但是当我试图与不具备的应用程序安装它不工作,另一个FB帐户。当我尝试登录下面的错误出现,我得到一个对话框,告诉我说,基本的权限将被授予,但在现实中,我甚至不得到基本权限。

我已经为了提交应用程序进行审查,以把它显示在应用程序中心。当我这样做,该对话框显示了一个复选框,我承认,我的应用程序使用SSO。实是否需要批准我的应用程序之前,我可以使用SSO(如果是这样,这是没有意义的)

我花了几个小时试图解决这个问题,我不能找到解决办法。请大家帮帮忙。

  1月八日至24日:39:16.058:W /包(21880):主要com.facebook.platform.protocol.PROTOCOL_VERSION期望的字符串,但价值是一个java.lang.Integer中。默认值小于;空>被退回。
1月8号至24日:39:16.068:W /包(21880):尝试投产生的内部异常:
1月8号至24日:39:16.068:W /包(21880):java.lang.ClassCastException:java.lang.Integer中不能转换为java.lang.String
1月8号至24日:39:16.068:W /包(21880):在android.os.Bundle.getString(Bundle.java:1069)
1月8号至24日:39:16.068:W /包(21880):在android.content.Intent.getStringExtra(Intent.java:4350)
1月8号至24日:39:16.068:W /包(21880):在com.facebook.AuthorizationClient$KatanaLoginDialogAuthHandler.tryAuthorize(AuthorizationClient.java:821)
1月8号至24日:39:16.068:W /包(21880):在com.facebook.AuthorizationClient.tryCurrentHandler(AuthorizationClient.java:272)
1月8号至24日:39:16.068:W /包(21880):在com.facebook.AuthorizationClient.tryNextHandler(AuthorizationClient.java:238)
1月8号至24日:39:16.068:W /包(21880):在com.facebook.AuthorizationClient $ GetTokenAuthHandler.getTokenCompleted(AuthorizationClient.java:772)
1月8号至24日:39:16.068:W /包(21880):在com.facebook.AuthorizationClient $ GetTokenAuthHandler $ 1.completed(AuthorizationClient.java:731)
1月8号至24日:39:16.068:W /包(21880):在com.facebook.internal.PlatformServiceClient.callback(PlatformServiceClient.java:144)
1月8号至24日:39:16.068:W /包(21880):在com.facebook.internal.PlatformServiceClient.handleMessage(PlatformServiceClient.java:128)
1月8号至24日:39:16.068:W /包(21880):在com.facebook.internal.PlatformServiceClient $ 1.handleMessage(PlatformServiceClient.java:54)
1月8号至24日:39:16.068:W /包(21880):在android.os.Handler.dispatchMessage(Handler.java:99)
1月8号至24日:39:16.068:W /包(21880):在android.os.Looper.loop(Looper.java:137)
1月8号至24日:39:16.068:W /包(21880):在android.app.ActivityThread.main(ActivityThread.java:5227)
1月8号至24日:39:16.068:W /包(21880):在java.lang.reflect.Method.invokeNative(本机方法)
1月8号至24日:39:16.068:W /包(21880):在java.lang.reflect.Method.invoke(Method.java:511)
1月8号至24日:39:16.068:W /包(21880):在com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:795)
1月8号至24日:39:16.068:W /包(21880):在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:562)
1月8号至24日:39:16.068:W /包(21880):在dalvik.system.NativeStart.main(本机方法)
 

解决方案

我也有类似的logcat输出,并发现它是有关在FB 3.5源$ C ​​$ C到不正确。正如AuthorizationClient.java上述it's线821。应该是的 getIntExtra 的而不是 getStringExtra 的。 从github上下载源代码,并更改

  intent.getStringExtra(NativeProtocol.EXTRA_PROTOCOL_VERSION));
 

 + intent.getIntExtra(NativeProtocol.EXTRA_PROTOCOL_VERSION,0));
 

I am developing an Android app that integrates with facebook. The app works perfectly fine when I set LoginButton.setLoginBehavior(SessionLoginBehavior.SUPPRESS_SSO).

The problem arises when I try to use SSO. I get the error below. I used to get a similar error when I used an incorrect keyhash; this is not the case anymore because the Webview log in works fine. What is event more surprising is that the Android app works if the app is installed in FB. For example, I am the app manager therefore it gets installed in my facebook profile by default, but when I try with another fb account that doesn't have the app installed it doesn't work. When I attempt to log in the error below appears and I get a dialog telling me that basic permissions will be granted, but in reality I do not even get basic permissions.

I have submitted the app for review in order to get it shown on the App Center. When I do that, the dialog shows a checkbox where I acknowledge that my app uses SSO. Does facebook need to approve my app before I can use SSO (if so, this doesn't make sense)

I have spent hours trying to solve this, and I can't find the solution. Please help.

08-24 01:39:16.058: W/Bundle(21880): Key com.facebook.platform.protocol.PROTOCOL_VERSION expected String but value was a java.lang.Integer.  The default value <null> was returned.
08-24 01:39:16.068: W/Bundle(21880): Attempt to cast generated internal exception:
08-24 01:39:16.068: W/Bundle(21880): java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
08-24 01:39:16.068: W/Bundle(21880):    at android.os.Bundle.getString(Bundle.java:1069)
08-24 01:39:16.068: W/Bundle(21880):    at android.content.Intent.getStringExtra(Intent.java:4350)
08-24 01:39:16.068: W/Bundle(21880):    at com.facebook.AuthorizationClient$KatanaLoginDialogAuthHandler.tryAuthorize(AuthorizationClient.java:821)
08-24 01:39:16.068: W/Bundle(21880):    at com.facebook.AuthorizationClient.tryCurrentHandler(AuthorizationClient.java:272)
08-24 01:39:16.068: W/Bundle(21880):    at com.facebook.AuthorizationClient.tryNextHandler(AuthorizationClient.java:238)
08-24 01:39:16.068: W/Bundle(21880):    at com.facebook.AuthorizationClient$GetTokenAuthHandler.getTokenCompleted(AuthorizationClient.java:772)
08-24 01:39:16.068: W/Bundle(21880):    at com.facebook.AuthorizationClient$GetTokenAuthHandler$1.completed(AuthorizationClient.java:731)
08-24 01:39:16.068: W/Bundle(21880):    at com.facebook.internal.PlatformServiceClient.callback(PlatformServiceClient.java:144)
08-24 01:39:16.068: W/Bundle(21880):    at com.facebook.internal.PlatformServiceClient.handleMessage(PlatformServiceClient.java:128)
08-24 01:39:16.068: W/Bundle(21880):    at com.facebook.internal.PlatformServiceClient$1.handleMessage(PlatformServiceClient.java:54)
08-24 01:39:16.068: W/Bundle(21880):    at android.os.Handler.dispatchMessage(Handler.java:99)
08-24 01:39:16.068: W/Bundle(21880):    at android.os.Looper.loop(Looper.java:137)
08-24 01:39:16.068: W/Bundle(21880):    at android.app.ActivityThread.main(ActivityThread.java:5227)
08-24 01:39:16.068: W/Bundle(21880):    at java.lang.reflect.Method.invokeNative(Native Method)
08-24 01:39:16.068: W/Bundle(21880):    at java.lang.reflect.Method.invoke(Method.java:511)
08-24 01:39:16.068: W/Bundle(21880):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795)
08-24 01:39:16.068: W/Bundle(21880):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:562)
08-24 01:39:16.068: W/Bundle(21880):    at dalvik.system.NativeStart.main(Native Method)

解决方案

I had a similar logcat output and found out that it was related to incorrectness in the FB 3.5 source code. As described above it´s on line 821 in AuthorizationClient.java. There should be getIntExtra instead of getStringExtra. Download the source from github and change

intent.getStringExtra(NativeProtocol.EXTRA_PROTOCOL_VERSION));

to

""+intent.getIntExtra(NativeProtocol.EXTRA_PROTOCOL_VERSION, 0));

 
精彩推荐
图片推荐