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

refresh_token flow removes refresh token after first use regardless of settings #1014

Open
datamystic opened this issue Feb 1, 2022 · 1 comment

Comments

@datamystic
Copy link

Using https://developers.google.com/oauthplayground, I confirmed that this library removes the refresh_token after the first use, regardless of the always_issue_new_refresh_token and unset_refresh_token_after_use settings e.g.

$server->addGrantType(new OAuth2\GrantType\RefreshToken($storage), array(
	'always_issue_new_refresh_token' => false,
	'unset_refresh_token_after_use' => false,
	'refresh_token_lifetime'         => 3600,  
));

I eventually worked around this by commenting out the code in

public function unsetRefreshToken($refresh_token)

and I will periodically remove expired access tokens from the DB with a script. Yuck.

@michdorf
Copy link

michdorf commented Nov 7, 2022

The problem seems to be, that the config option 'always_issue_new_refresh_token' is not respected in /vendor/bshaffer/oauth2-server-php/src/OAuth2/GrantType/RefreshToken.php

Another (temporary) solution to the problem is therefore to change line 144 from:
$issueNewRefreshToken = $this->config['always_issue_new_refresh_token'];

to

$issueNewRefreshToken = true;

It would be nice to have the code respect the config-options.

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

No branches or pull requests

2 participants