Can't get google refresh token after login with google

When i’m using login with google function, i cant’t get the refresh token.
This is my code:

webAuth.authorize({
                  connection: 'google-oauth2',
                  connection_scope: 'https://www.googleapis.com/auth/calendar,https://www.googleapis.com/auth/calendar.events',
                  scope: 'openid profile',
                  accessType: 'offline',
                  approvalPrompt: 'force'
                }, function(err) {
                  if (err) displayError(err);
                });

And all i get is access_token
image

I’ve tried to remove access of my app in my google account setting but it doesn’t work.
Can somebody help me, thank you!!

1 Like

i tried to add param access_type=offline and approval_prompt=force into my url and it work. But when click button login with google in auth0 form, i not see access_type and approval_prompt param. Is it bug from auth0 js?

Hey there everyone!

I feel the most effective way to handle that would be to raise it as a GitHub issue in the library repo so we can work on that directly with the repo maintainers. Once you have the link to it please share it here so we can ping them.

1 Like

I’ve already create a new issue on github:

Thank you

Perfect! Let me ping repo maintainers in a minute!

1 Like

Hi, i read that if i am using Auth0 Management API, i can’t get refresh token. But it’s auth0 refresh token, not google oauth2 refresh token, right?

1 Like

When i add state:'' to authorize method, it’s work. I wonder if it has any risks cause i’ve read that state is used to prevent attack?

webAuth.authorize({
                  connection: 'google-oauth2',
                  responseType: "code",
                  state:'',
                  connection_scope: 'https://www.googleapis.com/auth/calendar,https://www.googleapis.com/auth/calendar.events',
                  scope: 'openid profile email offline_access',
                  accessType: 'offline',
                  approvalPrompt: 'force'
                }, function(err) {
                  console.log(err);
                  if (err) displayError(err);
                });
1 Like