Hommer Smith
Hommer Smith

Reputation: 27852

Missing client_id with Devise and Facebook-Omniauth

Here is my initializers/devise.rb code for Facebook:

require "omniauth-facebook"
config.omniauth :facebook, "app_key", "app_secret"

And I have added:

devise :omniauthable into the model I want to be able to use Facebook with.

When I click on this link:

<%= link_to "Sign in with Facebook", user_omniauth_authorize_path(:facebook) %>

I get:

An OAuthException with message: "message": "Missing client_id parameter.",

Notice that the app_key and app_secret are the ones that I can see on my Facebook app but I haven't put here.

On the URL that is redirected when clicking the Sign in with facebook link I see that the client_id parameter is empty:

https://graph.facebook.com/oauth/authorize?response_type=code&client_id&

But why?

Upvotes: 3

Views: 3507

Answers (2)

Constantine M
Constantine M

Reputation: 1547

Add this in your devise.rb file

require "omniauth-facebook"
config.omniauth :facebook, "APP_ID", "APP_SECRET"

Dont forget to restart your app for the changes to take place.

Upvotes: 2

Constantine M
Constantine M

Reputation: 1547

I have never done it directly with devise. But this also works well with devise.

Omniauth podcast on RailsCasts

Alternatively, If you still want to stick with using devise built-in omiauth, try to find a way to provide it the app id and app secret. I'm pretty sure that you have to provide it in devise.rb in config/initializers/

Upvotes: 1

Related Questions