Missing client_id with Devise and Facebook-Omniauth

梦想与她 提交于 2019-12-10 22:15:18

问题


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?


回答1:


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/




回答2:


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.



来源:https://stackoverflow.com/questions/10891811/missing-client-id-with-devise-and-facebook-omniauth

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!