0

I need some help.

I have followed all the steps correctly to enable a Google sign in using omniauth.

My Config/Initializers/omniauth.rb

     require 'omniauth-google-oauth2'
     require 'dotenv'

        Rails.application.config.middleware.use OmniAuth::Builder do
        provider :google_oauth2,
        ENV["GOOGLE_APP_ID"],
        ENV["GOOGLE_APP_SECRET"]
.......

    end 

My routes are correct:

  get    '/auth/google_oauth2/callback', to: 'sessions#googleAuth'
  get    'auth/failure',                 to: redirect('/')
  get    'signout',                      to: 'sessions#destroy', as: 'signout'

I have saved credentials properly.

However I am still getting the following error when I click on Google Sign In to redirect to access.

The error is as follows:

  1. That’s an error.

Error: invalid_request

Missing required parameter: client_id

Learn more

Request Details access_type=offline client_id= prompt=consent redirect_uri=http://localhost:3000/auth/google_oauth2/callback response_type=code

Why am I getting the missing client_id error, when my project is properly set on the Google Console, everything else is fine.

Please help me get around this.

Thank you!

4

1 回答 1

0

嘿,谢谢大家的评论。

我能够通过添加来解决它

Dotenv.load 

到 Omniauth.rb

于 2019-01-12T01:24:19.930 回答