php-connect-sample icon indicating copy to clipboard operation
php-connect-sample copied to clipboard

Tokens

Open daniel503sv opened this issue 9 years ago • 1 comments

is there a way top update a token, because all the data is saved in session vars, so yo cant access to the funcion refreshToken.

daniel503sv avatar Sep 25 '17 21:09 daniel503sv

Yes, that is missing from the sample right now.

If you'd like to implement this, you can add this on line 76 of the LoginController to also save the refreshToken:

$_SESSION['refresh_token'] = $accessToken->getRefreshToken();

You will then need to check if the access token is still valid, and if not, use the refresh token to get and store a new valid access token.

This sample uses The PHP League's Oauth2 client library, which has documentation on how to obtain the refresh token here.

caitlinrussell avatar Sep 25 '17 22:09 caitlinrussell