Problem/Motivation

Upon confirming to revoke a given client account authorization it produces a fatal php error: LogicException: refresh token must be passed in or set as part of setAccessToken in Google\Client->fetchAccessTokenWithRefreshToken() (line 332 of /code/vendor/google/apiclient/src/Client.php

Steps to reproduce

Create a new client account
Authenticate the account
Select the operation to revoke the account authorization, click the confirm form submit.

fatal error ensues.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

tbenice created an issue. See original summary.

thedut’s picture

Status: Active » Needs review
StatusFileSize
new813 bytes

Hello,
Here is a patch fixing this issue.
You should first save the Client entity.
This issue occurs when revoking a client with an expired token.
Thanks to this patch : Client with expired token won't need manual revokation.

thedut’s picture

Title: Fatal error when revoking a Client Account » Handle expired or revoked client access_token
thedut’s picture

StatusFileSize
new3.14 KB

Hello here is the new patch, remplacing the previous one.
This patch protect the token_value from the Client entity to be overwriten by an invalid token.
In my case : when offline access expired (after 7 days) : during the first load of the client entity and just before trying to recover a new token from the expired token : the expired token was overwritten with an error message.
['error' => 'invalid_grant','error_description' => 'Token has been expired or revoked.']
--> when googleClient->fetchAccessTokenWithRefreshToken() was called, the token value was not there anymore et refreshing the token was a failure.
This patch to fix this issue.

elaman made their first commit to this issue’s fork.

  • elaman committed c5b6d813 on 8.x-4.x
    Issue #3487814: Handle invalid token refresh responses
    
elaman’s picture

Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.