简体   繁体   English

Facebook Unity SDK测试用户登录

[英]Facebook Unity SDK Test User login

I haven't been able to find anything specific to this issue I'm having, so I thought I would post it here. 我一直无法找到与此问题有关的任何内容,所以我想我会在这里发布。

I have an Android Unity app I'm working on, with the Facebook SDK plugin. 我有一个Android Unity应用程序,我正在使用Facebook SDK插件。 When working in the Unity editor, I can log in with my test users via their access tokens just fine. 在Unity编辑器中工作时,我可以通过他们的访问令牌与我的测试用户一起登录。 When deploying the app to an Android device however, it depends on whether the Facebook App itself is installed on the device. 但是,在将应用程序部署到Android设备时,这取决于Facebook App本身是否已安装在设备上。

If the Facebook App is installed on the device, my test users cannot log in at all. 如果Facebook应用程序安装在设备上,我的测试用户根本无法登录。 If I uninstall the Facebook App, the test users log in successfully as expected. 如果我卸载Facebook App,测试用户将按预期成功登录。

Is there a setting/configuration change/API call, something that I need to do in order to fix this? 是否有设置/配置更改/ API调用,我需要做些什么来解决这个问题? Obviously I would like my app to log in whether the device has the app installed or not. 显然我希望我的应用程序登录设备是否安装了应用程序。

Thank you very much for any info 非常感谢你的任何信息

Edit: I should clarify - if the Facebook App is installed, when the user logs in through my app, it does log them in with the Facebook App, but doesn't log them in within my app 编辑:我应该澄清 - 如果安装了Facebook应用程序,当用户通过我的应用程序登录时,它使用Facebook应用程序登录,但不会在我的应用程序中登录它们

Some more info which narrows things down some (I apologize for it being lengthy): Once a test user account does get logged in successfully in my app (without the Facebook App itself being installed on the device), from that point forward that test user account will log in to my app just fine even with the Facebook App installed. 一些更多的信息缩小了一些东西(我道歉它是冗长的):一旦测试用户帐户确实在我的应用程序中成功登录(没有Facebook应用程序本身安装在设备上),从那时起,测试用户即使安装了Facebook App,帐户也会很好地登录我的应用程序。

Scenario: 场景:

  1. Test user "Bob" is configured for my app, have preinstalled configured 为我的应用程序配置了测试用户“Bob”,已预先安装了配置

  2. "Bob" will log in with a token through Unity editor every time, issue is only on device “Bob”每次都会通过Unity编辑器使用令牌登录,问题仅出现在设备上

  3. Tablet has Facebook App installed 平板电脑已安装Facebook App

  4. Run my app on the device, try to log in with "Bob" 在设备上运行我的应用程序,尝试使用“Bob”登录

  5. Facebook App login dialog is instantiated for the login. Facebook App登录对话框实例化用于登录。

  6. App authorization dialog pops up, click OK to approve it 弹出应用程序授权对话框,单击“确定”以批准它

  7. My app returns back to the main scene, but "Bob" is not logged in 我的应用程序返回主场景,但“Bob”未登录

  8. Open the Facebook App, and find that "Bob" is logged into the Facebook App just fine 打开Facebook App,发现“Bob”登录Facebook App就好了

  9. Uninstall the Facebook App from the device 从设备卸载Facebook App

  10. Run my app (after clearing data), try to log "Bob" in again 运行我的应用程序(清除数据后),尝试再次登录“Bob”

  11. Smaller Facebook login dialog is instantiated, followed by auth dialogs 实例化较小的Facebook登录对话框,然后是auth对话框

  12. "Bob" logs in to my app just fine “鲍勃”很好地登录我的应用程序

Now - here is what else I found. 现在 - 这是我发现的其他内容。 Going along with that scenario - once I get a test user account logged in successfully for the first time through my app, I can reinstall the Facebook App, and it will have no impact on logging in again. 继续这种情况 - 一旦我通过我的应用程序第一次成功登录测试用户帐户,我可以重新安装Facebook应用程序,它将不会再次登录。 Once he's been logged in once with my app, he'll be fine from that point forward. 一旦他用我的应用程序登录过一次,从那时起他就会好起来的。 But if the Facebook App is installed when attempting to log in and approve the app the first time , it fails. 但是,如果在第一次尝试登录并批准应用程序时安装了Facebook应用程序,则会失败。

As requested, here is a logcat from a failed login attempt. 根据要求,这是一个登录尝试失败的logcat。 There definitely looks to be several issues, a permissions exception right off the bat, and perhaps that it trickling through to cause everything to fail. 肯定会出现几个问题,一个权限异常,也许它会彻底解决导致一切都失败的问题。 I'm not sure why there would be an issue with permissions as I'm sending request for email and publish_actions only, just as in the examples. 我不确定为什么会出现权限问题,因为我只发送电子邮件和publish_actions请求,就像在示例中一样。 In the end, my OnInitCallback is called with an indication that the login was cancelled (even though the authorization dialogs appeared and OK was clicked). 最后,调用我的OnInitCallback,指示登录被取消(即使出现授权对话框并单击了OK)。 Maybe that's FB way of eloquently backing out when things blow up? 也许这是FB在事情爆发时雄辩退出的方式? Not sure. 不确定。 In any case, I still haven't been able to solve how and why this is happening. 无论如何,我仍然无法解决这种情况发生的原因和原因。 Maybe I shouldn't worry about it and just hope and pray that the release build and actual users will be able to connect ok? 也许我不应该担心它,只是希望并祈祷发布版本和实际用户能够连接好吗?

W/fb4a(:<default>):BlueServiceQueue(28412): Exception during service

W/fb4a(:<default>):BlueServiceQueue(28412): com.facebook.http.protocol.ApiExcept
ion: The app cannot ask for publish or manage permissions along with read permis
sions.

W/fb4a(:<default>):BlueServiceQueue(28412):     at com.facebook.http.protocol.Ap
iResponseChecker.b(ApiResponseChecker.java:83)

W/fb4a(:<default>):BlueServiceQueue(28412):     at com.facebook.http.protocol.Ap
iResponseChecker.a(ApiResponseChecker.java:162)

W/fb4a(:<default>):BlueServiceQueue(28412):     at com.facebook.http.protocol.Ap
iResponse.g(ApiResponse.java:151)

W/fb4a(:<default>):BlueServiceQueue(28412):     at com.facebook.platform.auth.se
rver.AuthorizeAppMethod.a(AuthorizeAppMethod.java:275)

W/fb4a(:<default>):BlueServiceQueue(28412):     at com.facebook.platform.auth.se
rver.AuthorizeAppMethod.a(AuthorizeAppMethod.java:31)

W/fb4a(:<default>):BlueServiceQueue(28412):     at com.facebook.http.protocol.Ap
iResponseHandler.a(ApiResponseHandler.java:55)

W/fb4a(:<default>):BlueServiceQueue(28412):     at com.facebook.http.protocol.Ap
iResponseHandler.handleResponse(ApiResponseHandler.java:28)

W/fb4a(:<default>):BlueServiceQueue(28412):     at com.facebook.http.common.FbHt
tpRequestProcessor.a(FbHttpRequestProcessor.java:314)

W/fb4a(:<default>):BlueServiceQueue(28412):     at com.facebook.http.common.FbHt
tpRequestProcessor.a(FbHttpRequestProcessor.java:144)

W/fb4a(:<default>):BlueServiceQueue(28412):     at com.facebook.http.common.FbHt
tpRequestProcessor.b(FbHttpRequestProcessor.java:100)

W/fb4a(:<default>):BlueServiceQueue(28412):     at com.facebook.http.common.FbHt
tpRequestProcessor.a(FbHttpRequestProcessor.java:230)

W/fb4a(:<default>):BlueServiceQueue(28412):     at com.facebook.http.protocol.Si
ngleMethodRunnerImpl.a(SingleMethodRunnerImpl.java:402)

W/fb4a(:<default>):BlueServiceQueue(28412):     at com.facebook.http.protocol.Si
ngleMethodRunnerImpl.a(SingleMethodRunnerImpl.java:164)

W/fb4a(:<default>):BlueServiceQueue(28412):     at com.facebook.http.protocol.Ab
stractSingleMethodRunner.a(AbstractSingleMethodRunner.java:18)

W/fb4a(:<default>):BlueServiceQueue(28412):     at com.facebook.platform.common.
server.SimplePlatformOperation.a(SimplePlatformOperation.java:40)

W/fb4a(:<default>):BlueServiceQueue(28412):     at com.facebook.platform.common.
server.PlatformOperationHandler.a(PlatformOperationHandler.java:60)

W/fb4a(:<default>):BlueServiceQueue(28412):     at com.facebook.fbservice.servic
e.BlueServiceQueue.e(BlueServiceQueue.java:329)

W/fb4a(:<default>):BlueServiceQueue(28412):     at com.facebook.fbservice.servic
e.BlueServiceQueue.d(BlueServiceQueue.java:55)

W/fb4a(:<default>):BlueServiceQueue(28412):     at com.facebook.fbservice.servic
e.BlueServiceQueue$3.run(BlueServiceQueue.java:258)

W/fb4a(:<default>):BlueServiceQueue(28412):     at java.util.concurrent.Executor
s$RunnableAdapter.call(Executors.java:422)

W/fb4a(:<default>):BlueServiceQueue(28412):     at java.util.concurrent.FutureTa
sk.run(FutureTask.java:237)

W/fb4a(:<default>):BlueServiceQueue(28412):     at com.facebook.common.executors
.ListenableScheduledFutureImpl.run(ListenableScheduledFutureImpl.java:59)

W/fb4a(:<default>):BlueServiceQueue(28412):     at android.os.Handler.handleCall
back(Handler.java:733)

W/fb4a(:<default>):BlueServiceQueue(28412):     at android.os.Handler.dispatchMe
ssage(Handler.java:95)

W/fb4a(:<default>):BlueServiceQueue(28412):     at android.os.Looper.loop(Looper
.java:136)

W/fb4a(:<default>):BlueServiceQueue(28412):     at android.os.HandlerThread.run(
HandlerThread.java:61)

W/fb4a(:<default>):GDPDialog(28412): Failed to send

W/fb4a(:<default>):GDPDialog(28412): com.facebook.fbservice.service.ServiceExcep
tion: API_ERROR: API_ERROR

W/fb4a(:<default>):GDPDialog(28412):    at com.facebook.fbservice.ops.BlueServic
eOperation.c(BlueServiceOperation.java:639)

W/fb4a(:<default>):GDPDialog(28412):    at com.facebook.fbservice.ops.BlueServic
eOperation.c(BlueServiceOperation.java:47)

W/fb4a(:<default>):GDPDialog(28412):    at com.facebook.fbservice.ops.BlueServic
eOperation$2.run(BlueServiceOperation.java:604)

W/fb4a(:<default>):GDPDialog(28412):    at android.os.Handler.handleCallback(Han
dler.java:733)

W/fb4a(:<default>):GDPDialog(28412):    at android.os.Handler.dispatchMessage(Ha
ndler.java:95)

W/fb4a(:<default>):GDPDialog(28412):    at android.os.Looper.loop(Looper.java:13
6)

W/fb4a(:<default>):GDPDialog(28412):    at android.app.ActivityThread.main(Activ
ityThread.java:5017)

W/fb4a(:<default>):GDPDialog(28412):    at java.lang.reflect.Method.invokeNative
(Native Method)

W/fb4a(:<default>):GDPDialog(28412):    at java.lang.reflect.Method.invoke(Metho
d.java:515)

W/fb4a(:<default>):GDPDialog(28412):    at com.android.internal.os.ZygoteInit$Me
thodAndArgsCaller.run(ZygoteInit.java:779)

W/fb4a(:<default>):GDPDialog(28412):    at com.android.internal.os.ZygoteInit.ma
in(ZygoteInit.java:595)

W/fb4a(:<default>):GDPDialog(28412):    at dalvik.system.NativeStart.main(Native
 Method)

V/FBUnitySDK(30488): sending to Unity OnLoginComplete({"cancelled":true,"key_has
h":"(my keyhash was here)"})

We have test users logging into our unity app on Android with the FB app installed (sdk 5.0.4). 我们让测试用户在安装了FB应用程序的Android上登录我们的Unity应用程序(sdk 5.0.4)。

FB.Login("email,publish_actions", callback ) FB.Login(“email,publish_actions”,回调)

If you have a different scope, try removing some as the exception in your log indicates that is the problem. 如果您有不同的范围,请尝试删除一些,因为日志中的异常表明存在问题。 From the Facebook documentation, the readonly and publishing permissions should be made separately: https://developers.facebook.com/docs/facebook-login/permissions/#publishing 从Facebook文档中,应该单独进行只读和发布权限: https//developers.facebook.com/docs/facebook-login/permissions/#publishing

Once the users have logged in once, the login/validation happens in FB.Init() and so a different code path is taken. 一旦用户登录一次,登录/验证就会在FB.Init()中发生,因此会采用不同的代码路径。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM