Facebook Canvas application with Rails 3: Detect if user is a fan
Hello and excuse me again
I am trying to know if user in my canvas application is fan or not. I am working with Rails 3 with fbgraph gem.
So in my controller I try:
def find_auth
if params.has_key? :signed_request
session[:signed_request] = params[:signed_request]
@auth = authorizor.from_signed_request params[:signed_request]
decode_signed_request = Canvas.parse_signed_request(configatron.fb_authentication_app_secret, params[:signe开发者_Python百科d_request])
else
@auth = authorizor.from_signed_request session[:signed_request]
end
end
def authorizor
FbGraph::Auth.new(configatron.fb_authentication_app_key, configatron.fb_authentication_app_secret)
end
however decode_signed_request haven´t got page data only is a hash with 3 elements:
Algorithm
User(age,country and locale)
issued_at
Depending if the user is fan or not i should render a page or another. If the user is fan show the main content, else i should render a page with a like button. If the user click "like" I should ask for permission in a popup.
Thanks in advance. If you need more information please to comment.
I can solve my problem. In a canvas application this need permissions. However in tab application when i parsed params[:signed_request] exist a key with like information.
精彩评论