Skip to content

Instantly share code, notes, and snippets.

@therabidbanana
Created August 18, 2010 19:57
Show Gist options
  • Save therabidbanana/535968 to your computer and use it in GitHub Desktop.
Save therabidbanana/535968 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'flickraw-cached'
FlickRaw.api_key="... API KEY HERE ..."
FlickRaw.shared_secret="... Shared Secret ..."
frob = flickr.auth.getFrob
auth_url = FlickRaw.auth_url :frob => frob, :perms => 'read'
puts "Open this url in your process to complete the authication process : #{auth_url}"
puts "Press Enter when you are finished."
STDIN.getc
begin
auth = flickr.auth.getToken :frob => frob
login = flickr.test.login
puts "You are now authenticated as #{login.username} with token #{auth.token}"
rescue FlickRaw::FailedResponse => e
puts "Authentication failed : #{e.msg}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment