Ruby 使用facebook omniauth时遇到问题
我正在尝试通过facebook验证,我有一个sinatra应用程序可以与twitter正常工作 app.rbRuby 使用facebook omniauth时遇到问题,ruby,facebook,sinatra,Ruby,Facebook,Sinatra,我正在尝试通过facebook验证,我有一个sinatra应用程序可以与twitter正常工作 app.rb use OmniAuth::Builder do provider :twitter, 'xxx', 'yyy' provider :facebook, 'xxx', 'yyy', :redirect_uri => 'http://localhost:9393/auth/facebook' end 我在我的视图中引用了facebook链接 %a{:href=>"/
use OmniAuth::Builder do
provider :twitter, 'xxx', 'yyy'
provider :facebook, 'xxx', 'yyy', :redirect_uri => 'http://localhost:9393/auth/facebook'
end
我在我的视图中引用了facebook链接
%a{:href=>"/auth/twitter"} Sign In To Twitter
%a{:href=>"/auth/facebook"} Sign In To Facebook
我被送回了
看起来像
{
"error": {
"message": "Invalid redirect_uri: Given URL is not allowed by the Application configuration.",
"type": "OAuthException",
"code": 191
}
}
据我所知,我的设置看起来是正确的。关于这个问题的许多帖子都与facebook和应用注册的url有关
在facebook上,此应用注册为
Site URL
http://localhost:9393/
Site Domain
http://localhost:9393/
谢谢 尝试应用程序域:
http://localhost/
它在rails中为我工作
Site URL: http://localhost:3000/
App Domains: http://localhost/
我通常在facebook上注册一个开发应用程序,并将重定向uri添加到我的主机文件中。通常是这样的:
127.0.0.1 dev.mycoolapp.com
我真的找到了答案
App域:localhost/
及
登录Facebook的网站:http://localhost:9393/?
本地主机(带有fb登录的网站)上的/?
是重要的细节