I can’t seem to obtain refresh token from oauth2.Exchange() for a app under testing.
config.Exchange(ctx, code, oauth2.AccessTypeOffline, oauth2.ApprovalForce)
returns an access token with no refresh_token. What’s even more annoying is that oauth2.ApprovalForce
does not prompt an OAuth consent screen for some reason. It only prompts for the very first time, and even after consenting for the first time, does not return a refresh token.
Checking the request through the debugger, the following is sent in the body of the request:
access_type=offline&client_id=...&client_secret=...&grant_type=authorization_code&prompt=consent&redirect_uri=...
So the library should be working fine. I’ve added a custom option
SetAuthURLParam("approval_prompt", "force")
and that also doesn’t seem to work
Mono is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.