Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.8.0 breaks exiting scope handling #1052

Open
MrMooky opened this issue Dec 19, 2024 · 3 comments · May be fixed by #1053
Open

2.8.0 breaks exiting scope handling #1052

MrMooky opened this issue Dec 19, 2024 · 3 comments · May be fixed by #1053

Comments

@MrMooky
Copy link

MrMooky commented Dec 19, 2024

Last week's release introduced the following in the getAccessToken() function:

https://github.com/thephpleague/oauth2-client/pull/1030/files#diff-e8490e4bb8acb102745699d2bd7aa0a298d836c92d00d2ed57dd4c7ad8b24282

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.

@liayn
Copy link
Contributor

liayn commented Dec 21, 2024

Discussion to be continued in #1030 please.

@barryvdh barryvdh linked a pull request Dec 21, 2024 that will close this issue
@barryvdh
Copy link
Member

Can you try if #1053 fixes your issue?

@tm1000
Copy link

tm1000 commented Dec 23, 2024

@barryvdh that fixes the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants