使用Facebook和OAuth在ROR应用程序中登录时出错 [英] Error while login with Facebook and OAuth in ROR application
问题描述
我创建Rails应用程序,并希望通过Facebook登录。
我看了railsscast,阅读了几个教程,然后在stackoverflow上再回答20个问题...但是我仍然无法使用fb登录我的网站..
所以请帮助我解决这个问题。
Gemfile
gem'omniauth-facebook'
gem'koala','〜> 1.10.0rc'
config / initializers / omniauth.rb
OmniAuth.config.logger = Rails.logger
Rails.application.config.middleware.use OmniAuth :: Builder do
provider :facebook,Rails.application.secrets ['APP_ID'],Rails.application.secrets ['APP_SECRET'],{scope:'user_about_me'}
end
index.html.slim
h2欢迎
= link_to'用Facebook登录''/ auth / facebook'
Facebook - >开发人员 - > MyApp - > Settigns
Basic:
设置高级
之后用Facebook登录链接并在弹出窗口中确认我有错误:
给定URL不允许应用程序配置:One或$ b应用程式的设定不允许使用$ b以上的网址。它必须
匹配网站网址或画布网址,否则域必须是其中一个应用程序域名的子域
。
有人可以解释一下,Facebook或者我手上有什么问题吗?
更新:
确定,另一个错误:
当有效的OAuth重定向URI
设置为 http:// localhost:3000 / auth / facebook / callback /
,FACEBOOK回复错误给定URL不允许应用程序配置:一个或App的设置不允许使用更多的给定网址。它必须与网站网址或Canvas网址匹配,否则域名必须是应用程序域名之一的子域名。
但是当有效的OAuth重定向URI
设置为 http:// localhost:3000 / auth / facebook / callback
(不含/结束),我有OAuth2错误: OAuth2 ::错误
:{错误:{message:验证验证码错误请确保您的redirect_uri与您一样在OAuth对话框请求中使用,type:OAuthException,code:100,fbtrace_id:EYOCCnhlcFv}}
目前已被打破。现在有一个修复宝石的公司。
https://github.com/gioblu/omniauth-facebook/commit/eff97bfae32f72821cbccf0b48b78351e41eb585
Ok, guys, I give up. I create Rails app and want login with facebook. I watch railscast, read a few tutorials and more then 20 questions on stackoverflow... but still i can't login with fb on my site.. so, please, help me with this problem...
Gemfile
gem 'omniauth-facebook'
gem 'koala', '~> 1.10.0rc'
config/initializers/omniauth.rb
OmniAuth.config.logger = Rails.logger
Rails.application.config.middleware.use OmniAuth::Builder do
provider :facebook, Rails.application.secrets['APP_ID'], Rails.application.secrets['APP_SECRET'], { scope: 'user_about_me' }
end
index.html.slim
h2 Welcome
= link_to 'Login with Facebook', '/auth/facebook'
Facebook -> Developers -> MyApp -> Settigns Basic:
Settings Advanced
And after 'Login with Facebook' link and confirm in popap I have error:
Given URL is not permitted by the Application configuration: One or more of the given URLs is not permitted by the App's settings. It must match the Website URL or Canvas URL, or the domain must be a subdomain of one of the App's domains.
Can somebody explain me, what's wrong with Facebook or with my hands?
UPDATE:
ok, another error:
When Valid OAuth redirect URIs
set to http://localhost:3000/auth/facebook/callback/
, FACEBOOK respond with error Given URL is not permitted by the Application configuration: One or more of the given URLs is not permitted by the App's settings. It must match the Website URL or Canvas URL, or the domain must be a subdomain of one of the App's domains.
But when Valid OAuth redirect URIs
set to http://localhost:3000/auth/facebook/callback
(without '/' at the end), I have OAuth2 error: OAuth2::Error
: {"error":{"message":"Error validating verification code. Please make sure your redirect_uri is identical to the one you used in the OAuth dialog request","type":"OAuthException","code":100,"fbtrace_id":"EYOCCnhlcFv"}}
It is currently broken. There is a pr out to fix the gem right now.
https://github.com/gioblu/omniauth-facebook/commit/eff97bfae32f72821cbccf0b48b78351e41eb585
这篇关于使用Facebook和OAuth在ROR应用程序中登录时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!