Tag: Facebook的的OAuth

Facebook OAuth未在用户信息中返回电子邮件

我正在进行狂欢3.0安装(ROR)并尝试使用facebook oauth进行身份validation,但是在成功的oauth之后发回的字段不包含对我们的应用程序至关重要的电子邮件。 这是从facebook成功validation返回的。 #<OmniAuth::AuthHash credentials=# extra=#<OmniAuth::AuthHash raw_info=#> info=# provider=”facebook” uid=”101230990227589″ 正如你所看到的,我得到的只是用户名和他们的ID。 我的Facebook应用程序上是否有一些设置需要检查以便收回电子邮件? 或者我有什么不同的方式做Oauth? 我只是使用spree_social gem,它在内部完成这一切,所以我实际上并没有编写任何代码。 这是代码。 复制出gem,我只是添加了日志行,看看从Facebook回来的东西。 def #{provider} authentication = Spree::UserAuthentication.find_by_provider_and_uid(auth_hash[‘provider’], auth_hash[‘uid’]) if authentication.present? and authentication.try(:user).present? flash[:notice] = I18n.t(‘devise.omniauth_callbacks.success’, kind: auth_hash[‘provider’]) sign_in_and_redirect :spree_user, authentication.user elsif spree_current_user spree_current_user.apply_omniauth(auth_hash) spree_current_user.save! flash[:notice] = I18n.t(‘devise.sessions.signed_in’) redirect_back_or_default(account_url) else user = Spree::User.find_by_email(auth_hash[‘info’][’email’]) || Spree::User.new user.apply_omniauth(auth_hash) Rails.logger.debug(“THE AUTO HASH”) Rails.logger.debug(auth_hash.inspect) if […]

Omniauth-facebook哈希没有显示Facebook’用户名’字段,使用rails 3

我已经设置了我的rails 3应用程序以使用omniauth-facebook,一切正常但是当我将omniauth hash看作yaml时没有’nickname’字段,我可以得到’name’和’email’但我的validation无法创建用户,因为我无法获取应用程序用户名要求的昵称。 我已经在“设置”下仔细检查了我的Facebook帐户,并显示了我的用户名。 任何想法为什么会发生这种情况? 谢谢您的帮助。 这是我的omniauth哈希的一个例子,我出于隐私原因放置了’X’: — !ruby/hash:OmniAuth::AuthHash provider: facebook uid: ‘XXXXXXXXXXXXX’ info: !ruby/hash:OmniAuth::AuthHash::InfoHash email: XXXX@XXXX.XX name: XXXX XXXX first_name: XXXX last_name: XXXX image: http://graph.facebook.com/XXXXXXXXXXXXX/picture urls: !ruby/hash:OmniAuth::AuthHash Facebook: https://www.facebook.com/app_scoped_user_id/XXXXXXXXXXXXX/ verified: true credentials: !ruby/hash:OmniAuth::AuthHash token: ACCESS_TOKEN expires_at: 1406357169 expires: true extra: !ruby/hash:OmniAuth::AuthHash raw_info: !ruby/hash:OmniAuth::AuthHash id: ‘XXXXXXXXXXXXXXX’ email: XXXX@XXXX.XX first_name: XXXX gender: male last_name: XXXX link: […]

修复Rails oauth facebook x-frame-options sameorigin错误

我不能为我的生活让我的Facebookcanvas应用程序显示。 Chrome控制台显示此错误,iframe中没有任何内容显示 – 它是空白的: Refused to display ‘http://mysite.dev/’ in a frame because it set ‘X-Frame-Options’ to ‘SAMEORIGIN’. 我正在使用Rails 4.0.0.rc1和omn​​iauth-facebook 1.4.1 , 以Facebook身份validation上的Railscast作为指南。 我没有使用任何Javascript代码,因为它是可选的,理想情况下应该只能在Facebook中访问应用程序。 的routes.rb match ‘auth/:provider/callback’, to: ‘sessions#create’, via: [:get, :post] match ‘auth/failure’, to: redirect(‘/’), via: [:get, :post] match ‘signout’, to: ‘sessions#destroy’, as: ‘signout’, via: [:get, :post] sessions_controller.rb class SessionsController < ApplicationController def create user […]