The Client Credentials and Resource Owner grants needs to also use the refresh token when their tokens has expired

Currently only the Authorization Code grant is generating a new token using the refresh token if token has expired. This patch will also have the Client Credentials and Resource Owner grants make use of the refresh token.

Comments

jagermonster created an issue. See original summary.

jagermonster’s picture

ivan.chavarro’s picture

I got this error when I tried to use this patch:
BadMethodCallException: Required parameter not passed: "refresh_token" in League\OAuth2\Client\Grant\AbstractGrant->checkRequiredParameter() (line 35 of /app/vendor/league/oauth2-client/src/Tool/RequiredParameterTrait.php).

I figured out my issue working with this path instead: https://www.drupal.org/project/oauth2_client/issues/3064090

fathershawn’s picture

Hi! @perelesnyk and I have stepped up as maintainers, officially for D9 compatible and forward. I've added this issue to our planning issue. The Oauth2 standard has Refresh tokens as optional in general:

Issuing a refresh token is optional at the discretion of the authorization server. If the authorization server issues a refresh token, it is included when issuing an access token

https://tools.ietf.org/html/rfc6749#section-1.5

So if a refresh token is returned with the original access token, we should use it on all grant types

fathershawn’s picture

Status: Needs review » Closed (duplicate)
fathershawn’s picture