Take the 2-minute tour ×

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?

share|improve this question
add comment

1 Answer

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.

share|improve this answer
can i do that via the SDK? –  siamii Aug 30 '11 at 2:46
yeah its the same as any other call. something like facebook.request("me/permissions"); as seen on coolvideolearning.com/… –  bkaid Aug 30 '11 at 2:56
What about the 2nd paragraph in the question? –  siamii Aug 30 '11 at 3:08
add comment

Your Answer


