I have an application in which users can link their Facebook accounts. They can log in using their email, but they can link their Facebook account.
In the view where I show related social networks (Facebook and others), I have something like this:
<%= image_tag @facebook.get_facebook_picture %>
This will call an instance method similar to this:
def get_facebook_picture unless self.token.nil? facebook_graph = Koala::Facebook::GraphAPI.new(self.token) fb_picture = facebook_graph.get_picture("me", { :type => "small" }) end end
This will work well if the Facebook token I saved in my database has expired. Therefore, I added this exception handler to the specified controller:
def facebook_exception_handler exception if exception.fb_error_type.eql? 'OAuthException'
I understand the exception correctly, but I donβt see how to update the access token that I have in my database. Please note that the access token that I have was inserted using OmniAuth. So my question is:
Given that I have an OAuthException , how can I update a specific user access token (UID) using Omniauth ?
ruby-on-rails facebook access-token omniauth koala
Noba
source share