PHP Classes

Remove access token when user is logged out of OAuth service

Recommend this page to a friend!

      PHP OAuth Library  >  All threads  >  Remove access token when user is...  >  (Un) Subscribe thread alerts  
Subject:Remove access token when user is...
Summary:Problem with logout
Messages:4
Author:Dima
Date:2013-10-24 14:29:35
Update:2013-10-25 06:57:05
 

  1. Remove access token when user is...   Reply   Report abuse  
Picture of Dima Dima - 2013-10-24 14:29:35
Thank you for such an easy to start library.
For now i have one problem:
im using OAuth api to login with facebook. But when the user logs out of facebook-my program still allows him to login via facebook, CallAPI returns 1(success). Im new to using oauth, can i recheck if user is loggedin facebook and disallow him to login to my system if he is logged out.

  2. Re: Remove access token when user is...   Reply   Report abuse  
Picture of Dima Dima - 2013-10-24 14:41:36 - In reply to message 1 from Dima
Am i right to call ResetAccessToken() always before finalize?

$client->ResetAccessToken();
$success = $client->Finalize($success);
Seems that this fixes my problem. If user is authorized in facebook- he logs in without problem. Otherwise- he is asked to login to facebook again.

  3. Re: Remove access token when user is...   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2013-10-24 19:20:16 - In reply to message 1 from Dima
Well in reality there is not really a logout operation for OAuth. Some servers may implement an API call for that but it is not standard.

ResetAccessToken just makes the class forget about the previously obtained token, but that does not make the token invalid.

Calling ResetAccessToken before Finalize is recommended because depending on the OAuth sub-class you are using Finalize may for instance disconnect from the database where the token is stored, so it would not be able to forget the token.

  4. Re: Remove access token when user is...   Reply   Report abuse  
Picture of Dima Dima - 2013-10-25 06:57:05 - In reply to message 3 from Manuel Lemos
Thank you for the answer!