zquestz / omniauth-google-oauth2

Oauth2 strategy for Google
1.47k stars 414 forks source link

the field refresh token is blank on credentials in oauth process #438

Closed FernandoZX closed 6 months ago

FernandoZX commented 1 year ago

When i authenticated by google oauth doesn't display the refresh token value on this hash object of credentials see below:

 "credentials" => {
    "token" => "TOKEN",
    "refresh_token" => "REFRESH_TOKEN",
    "expires_at" => 1496120719,
    "expires" => true
  },

and i tried using the prompt 'select_account consent' for get the refresh token where i followed the solution on this post issue but still blank the refresh token and theres my config using devise gem

config.omniauth :google_oauth2, ENV.fetch('GOOGLE_API_CLIENT_ID', nil), ENV.fetch('GOOGLE_API_CLIENT_SECRET', nil), {
    scope: 'email,profile,calendar',
    access_type: 'online',
    prompt: 'select_account consent',
    provider_ignores_state: true,
    hd: ENV.fetch('GOOGLE_HOSTED_DOMAIN', nil)
  }

There something missing configuration on the project or on the developer console of google. tech using in my project Rails 7.0.4 Devise 4.8.1 omniauth 2.1.0 omniauth-google-oauth 1.1.1 omniauth-rails_csrf_protection 1.0.1 google-apis-calendar_v3 0.24.0

Kind regards.

Ypyth7 commented 1 year ago

Оу с этим я не разбираюсь

Ypyth7 commented 1 year ago

00000000000

Ypyth7 commented 1 year ago

Я делаю сайты Вот

zquestz commented 1 year ago

Make sure to set the access_type to offline if you require a refresh token.