OmniAuth Facebook expired token error

前端 未结 3 884
滥情空心
滥情空心 2021-02-04 22:14

I am using OmniAuth to get access to Facebook in my app. I am using the fb_graph gem: https://github.com/nov/fb_graph to post to Facebook. I am running omniauth-0.3.0 on Heroku

3条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-04 22:51

    I was using similar solution before you answered this question-

      class SessionsController < ApplicationController  
      def create  
     auth = request.env["omniauth.auth"]  
     user = User.find_by_provider_and_uid(auth["provider"], auth["uid"]) ||  User.create_with_omniauth(auth)  
    
     user.update_attributes(:token => auth["credentials"]["token"])
    
     session[:user_id] = user.id  
     redirect_to root_url, :notice => "Signed in!"  
    
      end
    

提交回复
热议问题