vendredi 15 janvier 2016

Google authentication error: invalid_request Missing required parameter: client_id

I'm trying to make google authentication using omniauth-google-oauth2 gem in my project and I've stumbled upon the following error when following this link localhost:3000/auth/google_oauth2/.

enter image description here

Why is that?

config/initializers/omniauth.rb

Rails.application.config.middleware.use OmniAuth::Builder do
  provider :google_oauth2, ENV["GOOGLE_CLIENT_ID"], ENV["GOOGLE_CLIENT_SECRET"]
end

config/routes.rb

Rails.application.routes.draw do
  get '/auth/:provider/callback', to: 'sessions#create'

  root to: 'welcome#index'
end

config/secrets.yml

development:
  secret_key_base: here_goes_my_secret_key_base
  google_client_id: 283155193283-8hnfdph0n4089iql70dh8g7428d258qc.apps.googleusercontent.com
  google_client_secret: xHnbKtackWe4D_1mrWTbRS9f

test:
  secret_key_base: here_goes_my_secret_key_base

production:
  secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
  google_client_id: <%= ENV["GOOGLE_CLIENT_ID"] %>
  google_client_secret: <%= ENV["GOOGLE_CLIENT_SECRET"] %>

Aucun commentaire:

Enregistrer un commentaire