Skip to content

BaseOAuth method - refreshAccessToken sends request when no refresh token exists #396

@kalmerkaurson

Description

@kalmerkaurson

I receive 400 error when I use method getAccessToken() of class \yii\authclient\BaseOAuth, and no refresh_token is present for the token.

What steps will reproduce the problem?

  1. Set $autoRefreshAccessToken to true for \yii\authclient\clients\Oauth2Client
  2. Authenticate client with a token that does not contain refresh_token
    /** * @var \yii\authclient\clients\Oauth2Client $client */ $client->authenticateClient();
  3. Wait for token to expire
  4. Use getAccessToken method to get access token
    /** * @var \yii\authclient\clients\Oauth2Client $client */ $client->getAccessToken();
  5. I receive 400 error from refreshAccessToken method, because refresh_token was not present in the token

What's expected?

Request is not sent out when refresh_tokenis not present and the old token is returned instead.

What do you get instead?

I receive 400 Refresh Token cannot be blank.

Additional info

Q A
Yii version 2.0.52
Yii Auth Client version 2.2.16
Yii HTTP Client version 2.0.16
PHP version 7.4
Operating system Linux (Manjaro)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions