I am creating a canvas application with rails and authorization authorization on a koala, but I do not know if I am doing the right thing. How to get permissions from the user? Now I am doing something like the code below, but I know that this is wrong, because when the user is redirected, he needs to click the "Access to Facebook" button before giving permission ...
before_filter :parse_signed_request
def parse_signed_request
@oauth = Koala::Facebook::OAuth.new('callback')
@signed_request = @oauth.parse_signed_request(params[:signed_request])
if @signed_request["user_id"]
@graph = Koala::Facebook::GraphAPI.new(@signed_request["oauth_token"])
else
redirect_to @oauth.url_for_oauth_code(:permissions => "publish_stream");
end
end
source
share