File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -144,13 +144,16 @@ $provider = new \League\OAuth2\Client\Provider\GenericProvider([
144144]);
145145
146146$existingAccessToken = getAccessTokenFromYourDataStore();
147+ $existingRefreshToken = getRefreshTokenFromYourDataStore();
147148
148149if ($existingAccessToken->hasExpired()) {
149- $newAccessToken = $provider->getAccessToken('refresh_token', [
150- 'refresh_token' => $existingAccessToken->getRefreshToken()
150+ $tokens = $provider->getAccessToken('refresh_token', [
151+ 'refresh_token' => $existingRefreshToken
151152 ]);
152153
153- // Purge old access token and store new access token to your data store.
154+ // Purge old tokens and store new ones to your data store.
155+ saveNewAccessTokenToYourDataStore($tokens->getToken());
156+ saveNewRefreshTokenToYourDataStore($tokens->getRefreshToken());
154157}
155158```
156159
You can’t perform that action at this time.
0 commit comments