Skip to content

Instantly share code, notes, and snippets.

@juliojgarciaperez
Created August 17, 2016 08:06
Show Gist options
  • Star 10 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save juliojgarciaperez/31ccb391cb1fbcb04dc86a16038fca24 to your computer and use it in GitHub Desktop.
Save juliojgarciaperez/31ccb391cb1fbcb04dc86a16038fca24 to your computer and use it in GitHub Desktop.
require 'mechanize'
require 'pry'
L = 'https://www.facebook.com/v2.6/dialog/oauth?redirect_uri=fb464891386855067%3A%2F%2Fau' \
'thorize%2F&scope=user_birthday,user_photos,user_education_history,email,user_relatio' \
'nship_details,user_friends,user_work_history,user_likes&response_type=token%2Csigned' \
'_request&client_id=464891386855067'.freeze
USER_AGENT = 'Mozilla/5.0 (Linux; U; en-gb; KFTHWI Build/JDQ39) AppleWebKit/535.19 (KHTML' \
', like Gecko) Silk/3.16 Safari/535.19'.freeze
def wrong_args
puts 'usage: ruby tinder_fb_token.rb email password'
end
wrong_args if ARGV.count != 2
mechanize = Mechanize.new
mechanize.user_agent = USER_AGENT
login_form = mechanize.get(L).form do |f|
f.email = ARGV[0]
f.pass = ARGV[1]
end
result = login_form.submit.form.submit.body.split('access_token=')[1].split('&')[0]
puts "Facebook Access Token: #{result}"
@Thatchantique
Copy link

Getting tinder_fb_token.rb:26:in '<main>': undefined method 'split' for nil:NilClass (NoMethodError) but no idea why its not working for that split method.

I am on ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-darwin17] and Rails 5.1.4.

Same issue !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment