2.8.0 breaks exiting scope handling
MrMooky opened this issue · 5 comments
Last week's release introduced the following in the getAccessToken() function:
if (empty($options['scope'])) {
$options['scope'] = $this->getDefaultScopes();
}
if (is_array($options['scope'])) {
$separator = $this->getScopeSeparator();
$options['scope'] = implode($separator, $options['scope']);
}
This broke my existing integration because previously added scopes were lost and I got an API error: ACCESS_TOKEN_SCOPE_INSUFFICIENT.
To "fix" the issue, I had to add the scopes like this while refreshing the token:
$newAccessToken = $this->provider->getAccessToken('refresh_token', [
'refresh_token' => $existingAccessToken->getRefreshToken(),
'scope' => ['openid', 'email', 'profile', 'https://www.googleapis.com/auth/drive.file'],
]);
All the default ('openid', 'email', 'profile') scopes, plus the one I already added while calling getAuthorizationUrl(). So to me, 2.8.0 is a breaking change that should have been mentioned.
I have been going crazy chasing this issue with the Google Provider where the scopes requested outside of the default were being lost on refresh token actions.
I have downgraded back to 2.7.0 temporarily to fix this. It would be good to pin this issue because the Google Provider gets broken pretty bad by this currently.
Thanks a lot for reporting this bug! We just spent 5 hours debugging our app only to find out that this little piece of code was breaking everything. Pinning the dependency to 2.7.0 works perfectly.