Last active
December 23, 2015 16:49
-
-
Save julianalucena/6664319 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'koala' | |
app_id = "xxx" | |
app_secret = "xxx" | |
callback_url = "http://0.0.0.0:3000/callback/" | |
oauth = Koala::Facebook::OAuth.new(app_id, app_secret, callback_url) | |
url = oauth.url_for_oauth_code(permissions: ["email", "user_likes"]) | |
puts "Redirecione o usuário para o Facebook: #{url}" | |
puts "\nInsira o Authorization code retornado pelo Facebook." | |
authorization_code = gets.chomp | |
access_token = oauth.get_access_token(authorization_code) | |
graph = Koala::Facebook::API.new(access_token) | |
my_friends = graph.get_connections("me", "friends") | |
puts my_friends |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment