在ROR应用程序中使用Facebook和OAuth登录时出错
伙计们,我放弃了。 我创建Rails应用程序,并希望登录Facebook。 我看看railscast,阅读一些教程以及关于stackoverflow的20多个问题…但我仍然无法在我的网站上使用fb登录..所以,请帮助我解决这个问题…
的Gemfile
gem 'omniauth-facebook' gem 'koala', '~> 1.10.0rc'
配置/初始化/ 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 – >开发者 – > MyApp – > Settigns Basic:
设置高级
在“使用Facebook登录”链接并在popap中确认后,我有错误:
应用程序配置不允许使用URL:应用程序的设置不允许使用一个或多个给定的URL。 它必须与网站URL或Canvas URL匹配,或者域必须是App域之一的子域。
有人可以解释我,Facebook或我的手有什么问题吗?
更新:好的,另一个错误:当Valid OAuth redirect URIs
设置为http://localhost:3000/auth/facebook/callback/
,FACEBOOK响应错误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.
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.
但是当Valid OAuth redirect URIs
设置为http://localhost:3000/auth/facebook/callback
(末尾没有’/’)时,我遇到OAuth2错误: 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"}}
它目前已被打破。 现在有一个pr out来修复gem。
https://github.com/gioblu/omniauth-facebook/commit/eff97bfae32f72821cbccf0b48b78351e41eb585
- Facebook重定向url在ruby on rails上打开ssl错误
- 如何绕过Rails 3中的protect_from_forgery获取Facebookcanvas应用?
- 测试Web应用程序与Cucumber的Facebook集成
- Facebook登录OmniAuth错误更改被拒绝
- 修复Rails oauth facebook x-frame-options sameorigin错误
- OmniAuth Facebook过期令牌错误
- 通知ala Facebook(数据库实施)
- Omniauth-facebook哈希没有显示Facebook’用户名’字段,使用rails 3
- 如何在配置/初始化程序中使用YML值