# How to solve Expired / Revoke Google token from identity provider

**URL:** <https://community.auth0.com/t/how-to-solve-expired-revoke-google-token-from-identity-provider/137437>\
**Category:** Get Help\
**Tags:** google-social-connection, connections\
**Created:** [June 26, 2024, 12:29am UTC](https://community.auth0.com/t/how-to-solve-expired-revoke-google-token-from-identity-provider/137437 "2024-06-26T00:29:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![alexandro.oliveira](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/alexandro.oliveira/32/48573_2.png) [@alexandro.oliveira](https://community.auth0.com/u/alexandro.oliveira)\
**Post date:** [June 26, 2024, 12:29am UTC](https://community.auth0.com/t/how-to-solve-expired-revoke-google-token-from-identity-provider/137437/1 "2024-06-26T00:29:26Z")

</div>

Hi community,

I need help with an Identity Provider (IdP) issue.

Situation: I can’t find a way to [refresh / create new] Google access tokens.

My Google Social connection is configured, and login with Google works fine. In the google-oauth2 \> permissions, I have Google Calendar enabled.

I am using React / Rails. When I log in, it asks me for permission to access my calendar, which works fine, and I can get the access token.

To ensure it’s working, I can create events on the calendar and check them at: [https://www.googleapis.com/oauth2/v3/tokeninfo?access\_token=IDENTITY\_GOOGLE\_ACCESS\_TOKEN](https://www.googleapis.com/oauth2/v3/tokeninfo?access_token=IDENTITY_GOOGLE_ACCESS_TOKEN), and I have my account information.

The problem is: after the token expires or is revoked, I’m stuck.

I have tried many approaches based on various tickets (most closed without a solution) and GitHub issues.

While searching for how to refresh a Google access token, I found this:

Link 1: [How to refrsh the access token provided by google](https://community.auth0.com/t/how-to-refrsh-the-access-token-provided-by-google/108286)

“Based on your description, you would like to refresh the access token provided by Google. For that use, you will need to revoke your access token with a refresh token that is provided to you with the access token.”

I don’t know if I understand this correctly. If I revoke, I will need to reauthenticate. Isn’t that breaking the Auth0 flow? Correct me if I’m wrong.

Link 2: [Not getting back a refresh\_token from Google · Issue #126 · auth0/auth0.js · GitHub](https://github.com/auth0/auth0.js/issues/126)

Even using the scope offline, offline\_access, it does not work. As I know, the scope access\_type offline should go to Google, and with the IdP token I got:

```auto
"sub": "1116854476550",
"scope": "https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile openid",
"exp": "1719364447",
"expires_in": "3565",
"email_verified": "true",
"access_type": "online"

```

Link 3: [Identity Provider Access Tokens](https://auth0.com/docs/secure/tokens/access-tokens/identity-provider-access-tokens#renew-third-party-tokens)

Here is more important information: Google OAuth 2.0 (pass the parameter access\_type=offline, as well as the connection\_scope parameter with required scopes, when calling the Auth0 /authorize endpoint)

I am not using the NextJS API for this, so where should I put this information?

I think it is not backend related because refresh\_token does not affect M2M, as we can see here: [Refresh token for M2M applications](https://community.auth0.com/t/refresh-token-for-m2m-applications/109853)

I can reference many attempts I made, but I think the previous information is enough to move forward.

An important side note: Every time I log out and log in with Google again, the Google token in my identities is updated and works again, even if it had been revoked or expired previously.

Possible workaround: After considering the right way to solve this, can I use getAccessTokenSilently to refresh the Google identity token? If so, can I pass it via a cookie? I am not sure.

I am open to discussing this topic and to opening a PR to fix it in auth0-js core, if needed.

---

<div class="post-metadata">

**Author:** ![alexandro.oliveira](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/alexandro.oliveira/32/48573_2.png) [@alexandro.oliveira](https://community.auth0.com/u/alexandro.oliveira)\
**Post date:** [June 27, 2024, 5:43pm UTC](https://community.auth0.com/t/how-to-solve-expired-revoke-google-token-from-identity-provider/137437/2 "2024-06-27T17:43:33Z")

</div>

The solution is here: [access\_type offline implementation · Issue #781 · auth0/auth0-react · GitHub](https://github.com/auth0/auth0-react/issues/781)

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [July 11, 2024, 5:44pm UTC](https://community.auth0.com/t/how-to-solve-expired-revoke-google-token-from-identity-provider/137437/3 "2024-07-11T17:44:28Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
