Search code examples
google-calendar-apitokenaccess-token

Getting a refresh token from google api


I've looked through other posts and they're either unanswered (Stopped getting refresh token from google's API) or no longer correct it seems.

I am trying to get a new refresh token from the google api, I have access_type = 'offline' and approval_prompt = 'force' but the response I'm getting back does not contain a refresh token. The other posts I have looked through says that having those two parameters should return me a refresh token.

Any ideas?

EDIT: I was thinking perhaps I could revoke the auth and have the user re-auth to get a fresh refresh_token. Would this work/is there a better solution?


Solution

  • I think I figured it out, instead of using approval_prompt=force you can use:

    {       
            ...
            access_type='offline',
            prompt='select_account consent'
    }
    

    to force a new approval screen and get a new refresh token.