nov / fb_graph_sample

An rails app using fb_graph. Learn how to authenticate facebook users using fb_graph and facebook's JavaScript SDK or OAuth2.

Home Page:http://fbgraphsample.heroku.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Issue with getting the profile

ankitenggcom opened this issue · comments

Once the user logged in and want to see the profile then there is an exception "FbGraph::Unauthorized Error validating application."

I try to dig out the issue and found that access_token is being saved directly where access_token is a Rack::OAuth2::AccessToken::Legacy class and to_yaml is being called before saving it. While accessing the profile using the code FbGraph::User.me(self.access_token).fetch it fails with above mentioned exception.

Working more on it I found that

FbGraph::User.me(YAML.load(self.access_token)).fetch

works fine.

Hi Nov,

Thanks for the fix.
Can you please let me know, why don't we use YAML.load? Because there are other instance variables that are needed for the session.

This sample app only needs access token.
If you need whole object, feel free to do so.

ps.
I recommend you to store expires_in as separated attribute.
It helps you to remove all expired tokens in 1 SQL.

Ok.
Thank you very much Nov.