php-connect-sample
php-connect-sample copied to clipboard
Tokens
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.
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.