MZH
MZH

Reputation: 1524

facebook Uncaught OAuthException: Error validating access token

I'm using facebook connect on my website, I'm authenticating using fb javascript sdk, and also using fb php sdk for getting users information, everything works fine but when the user logs out from facebook (from next tab), the php sdk throws an exception

Fatal error: Uncaught OAuthException: Error validating access token: The session is invalid because the user logged out. thrown in C:\wamp\www\fbjs\base_facebook.php on line 1033

After Logout from facebook the site behaves strange, I can get user id through this code even after the fb logout

$user = $facebook->getUser();///get my fb id

but then on next line it calls the api using the facebook object then it throw the above exception.

Any idea how can I check if the is the user is still on fb or not b/c I get fbid but exception on $facebook->api call.

Upvotes: 0

Views: 4017

Answers (1)

Todd Chaffee
Todd Chaffee

Reputation: 6824

The exception itself is what tells you if the user is logged in. Catch the exception, and re-run your authentication flow.

This article from the Facebook documentation might help:

http://developers.facebook.com/docs/authentication/

Upvotes: 0

Related Questions