开发者

Validate facebook oauth token in background

I'm开发者_高级运维 accessing Facebook in a background thread from my app. I initally logged in the user from my activity and stored the oauth token. It is possible that the oauth token has expired in the meantime, even with offline access. How could I check for valid oauth token with the Facebook Android SDK?

When I create a new Facebook object the oauth field is not set. I could set it from my stored token, but I didn't store the session expiry time. Therefore, looking at the source code, both isSessionValid() and request() will fail. I cannot authorize() the user from the background thread with a popup log-in dialog.

Does that mean that I cannot check for valid token via the SDK?


You could make a call to the graph api, for example to /me/permissions and check for an oauth exception and/or that you still have the permissions you need.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜