1

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!

3
  • 1
    Have you set these environment variables?? GOOGLE_APP_ID and GOOGLE_APP_SECRET I don't think you have, please do set it and then try. Commented Dec 31, 2018 at 9:06
  • i did set them up.. but it seems to not respond Commented Jan 4, 2019 at 0:40
  • Print logger statements and check if the environment variables are getting passed successfully into omniauth.rb Commented Jan 4, 2019 at 11:50

1 Answer 1

1

Hey thanks all for the comments.

I was able to resolve it by adding

Dotenv.load 

to the Omniauth.rb

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.