0

在我的网站 url 下的 facebook 应用程序中,我放了 - http://www.mydomainname.com/users/auth/facebook/callback

我也已将所有 facebook 凭据正确放入 config/initializers/devise.rb

用户需要单击 http://www.mydomain.com/profile 上的图像,该图像指向http://www.mydomainname.com/users/auth/facebook没有发生任何事情,看起来页面正在重定向并且然后它只显示 =">http://www.mydomain.com/profile# =

我检查了我的 production.log 文件,它正在显示(出于安全目的,我删除了部分令牌)

Started GET "/users/auth/facebook" for 108.107.140.124 at 2013-06-02 14:15:19 +0000


Started GET "/users/auth/facebook/callback?code=KJHKJHJKHKHJyadhanIUGYagdnianduifayuidfnyYYKghwViqVXpe6a69be8d50d51f9e971a06" for 108.107.140.124 at 2013-06-02 14:15:21 +0000
Processing by AuthenticationsController#facebook as HTML
  Parameters: {"code"=>"AQCJZPxjvAPbsHxcueSRKfK5xWQWlhxofFUBblb0fyyHgulTcPmZEVn5TzVhAbDBK1e4SPE21uIVTOj9nJ7r6lJMYYKghwViqVXpltdtEylL-v1V-EH9X9wUDLrVS3igX-al3L98MiYgW6YdPJhENBXRt3iksbmSXo33NHot8LMC8ntI9P8V0jybVXF9RZrfXetRoPrDzYsYt1mPfHB-y11evq_RKejvecHJFM81vH070uzBtS2kdjZcQNgwCdnd5CKKUHLyS22W1TAnY_m_BYjWYm59a1QfLyU2IFzeSUP0fjIp3RquzGFjAqBVpAo9MH8", "state"=>"87302acdf98eaf5ef54230526e6a69be8d50d51f9e971a06"}
**Redirected to http://www.mydomainname.com/profile**
Completed 302 Found in 11ms (ActiveRecord: 4.0ms)

一切看起来都很好,仍然没有身份验证,我做错了什么?

编辑 - Authentication_controller.rb 文件有

  def facebook
    omni = request.env["omniauth.auth"]
    token = omni['credentials'].token
    token_secret = omni['credentials'].secret

    authentication = Authentication.find_by_provider_and_uid(omni['provider'], omni['uid'])
    if authentication
      authentication.update_attributes(:token => token, :token_secret => token_secret)
    elsif current_user
      current_user.authentications.create!(:provider => omni['provider'], :uid => omni['uid'], :token => token, :token_secret => token_secret)
    end 

    flash[:notice] = "Successfully connected with facebook"
    redirect_to profiles_path
  end
4

0 回答 0