OAuth2.0 cannot get refresh token even when access_type=offline

google-oauth, oauth-2.0, python

Solution

Is this the first time you are authorizing with the application since you changed the parameter to `access_type=offline`? You will only retrieve refresh token once when client clicks authorization button to grant you access.

One workaround is to set another parameter `approval_prompt=force` so that user will always click on authorization button and you can always get refresh token. Otherwise, save refresh token locally so that you don't have to retrieve it again.

Problem

I see on the documentation that you need to set `access_type=offline` in order to get refresh token. I did set this value in OAuth url and I clearly see it properly set along with other parameters. However, I still don't get refresh token back as a response. I copy & pasted OAuth2 related code from this documentation.

Original source

Related problems