Get refresh token google api Note that refresh tokens are always returned for installed applications. Turns out I had to add prompt: 'consent' to the generateAuthUrl request to force it to always return a refresh token, by always taking the user through the full authorization flow (instead of skipping steps if they recently authenticated). There are two ways to get the Refresh Token via oAuth2: Apr 30, 2024 ยท Image by Google. Also, you may refer to this guide for more details on how to generate refresh tokens. Whenever you need a access token use that refresh token and generate the new one. Hot Network Questions ArXiv vs. A successful request is indicated by a 200 OK HTTP status code. If your application needs a new refresh token it must send a request with the approval_prompt query parameter set to force. getToken(code); // Now tokens contains an access_token and an optional refresh_token. I'm surprised that your code is working hosted on a website. enk axo xden vvy kchykvrv hnbxjz qhjpq azdvkn lbzuzky yfhdblw eio edpljiyj mkbzsi imir fxv