且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

验证访问令牌时出错:用户尚未授权应用程序。 Facebook SDK 4

更新时间:2022-06-17 07:35:35

调用 AccessToken.refreshCurrentAccessTokenAsync )为我工作。我得到错误在执行 FacebookCallback.onError(),其中我调用
AccessToken.refreshCurrentAccessTokenAsync()它清除了Facebook SDK中的访问令牌。

Calling AccessToken.refreshCurrentAccessTokenAsync() worked for me. I get the error in the implementation of FacebookCallback.onError(), where I call AccessToken.refreshCurrentAccessTokenAsync() which clears the access token in Facebook SDK.

由于这是一个异步调用,我无法调用 loginManager.logInWithReadPermissions()没有回调,所以我向用户显示一个 AlertDialog ,当用户点击确定时,我调用 loginManager.logInWithReadPermissions( )

Because this is an async call, I cannot call loginManager.logInWithReadPermissions() immediately; There is no callback, so I display an AlertDialog to the user and when the user clicks "OK", at that time I call loginManager.logInWithReadPermissions().

所以用户体验并不太糟糕,而且对于边缘情况也是可以接受的。

So user experience is not too bad, and it is acceptable for an edge case.