# Create a AccessToken based on the users access_token from the cookie
facebook = OAuth2::AccessToken.new(FacebookGraph, cookie_info['access_token'])
begin
# Fetch user data from Facebook
fb_info = JSON.parse(facebook.get('/me'))
# Check if the access token is for the given user
raise "Received wrong user from facebook"
unless fb_info['id'] == cookie_info['uid']
fb_info['facebook_uid'] = fb_info.delete('id')
return fb_info
rescue Exception => exc
logger.warn "Token verification failed for #{cookie_info.inspect} from #{request.remote_ip}, reason: #{exc}"
end
end
1 comments:
Hello, I log on to your new stuff on a regular basis.
Your writing style is awesome, keep up the good work!
my page raspberry ketone diet
Post a Comment