简体   繁体   中英

omniauth-google-oauth2 calendar sync giving invalid credential

I am using omniauth-google-oauth2 with branch: 'v0.2.10' for below mentioned scopes in code

Rails.application.config.middleware.use OmniAuth::Builder do
  provider :google_oauth2, APP_CONFIG['google_oauth2']['client_id'], APP_CONFIG['google_oauth2']['client_secret'], {
  access_type: 'offline',
  scope: 'https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/calendar',
  redirect_uri: "#{APP_CONFIG['site_url']}auth/google_oauth2/callback",
  skip_jwt: true,
  prompt: 'consent',
  provider_ignores_state: true
}
end

But when i try to sync calendar, it gives me invalid_credential error as below

auth/failure?message=invalid_credential?...

No more details available in response.

Please suggest me if i am doing anything wrong.

Does the APP_CONFIG['site_url'] come with slash in the end or not? anyway i thank it most be like that: #{APP_CONFIG['site_url']}/auth/google_oauth2/callback instead of: #{APP_CONFIG['site_url']}auth/google_oauth2/callback

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM