FBK
Just a bunch of methods that may come in handy when interacting with the Facebook Graph API.
We use this gem at Chicisimo.
Usage
require "sinatra"
require "fbk"
REDIRECT_URI = "https://something.com/login/fb/token"
FBK.configure do |config|
config.client_id = "xxx"
config.client_secret = "xxx"
end
get "/login/fb" do
redirect to(FBK.authorize_uri(redirect_uri: REDIRECT_URI, scope: %w{public_profile}))
end
get "/login/fb/token" do
code = params[:code]
access_token = FBK.get_access_token(redirect_uri: REDIRECT_URI, code: code)
user = FBK.get_user_info(access_token)
friends = FBK.get_user_friends(access_token)
picture = FBK.get_user_picture(access_token, type: "square", height: 256)
end