Open nmquaan-bigbom opened 5 years ago
If I'm not wrong the refresh token is only provided during the first authentication. You can revoke permission to your app and try to sign in again in order to retrieve it.
Hi @abrahamgnz, Thanks for the feedback. I try to do it and re-check my problem.
Hi @abrahamgnz , I did it again according to your instructions, but still not true to the results I expected. Do you have any solution to manually generate refresh_token. Thanks!
If you haven't solved your issue yet, you can get an authorization code from gapi.auth2.getAuthInstance().currentUser.get().grantOfflineAccess(). Then using the auth code, you can send it to your backend and exchange it for a refresh_token from google.
A problem you should encounter: by calling this grantOfflineAccess method, the user will be prompted to select their account, THEN they'll be prompted to consent to the scopes. This happens no matter you've called GoogleAuth.signIn() or not. I believe this to be an issue. If you encounter this issue, let the devs hear your frustration.
Best, Peter
@HerrPeter Is there any way to avoid the prompt to select user account and get new access token after it expires?
google sign in refresh docs are unclear and this whole issue is an annoying mess of callbacks, tokens, conditionals (oh, it works once but not again!) and forces devs to waste our time and forces users to click way too many times
Please see this solution for refreshing tokens client side => https://github.com/google/google-api-javascript-client/issues/643#issuecomment-642350903
Hi there, Please help resolve my problem, I want to get refresh_token when user login with google use javascript. This is my code.