Last active
January 2, 2016 12:59
-
-
Save joelongstreet/8307390 to your computer and use it in GitHub Desktop.
a sample of how to use oauth with VML's passport product
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 'oauth' | |
require 'json' | |
consumer = OAuth::Consumer.new ENV['PASSPORT_OAUTH_KEY'], | |
ENV['PASSPORT_OAUTH_SECRET'], | |
{ :site => 'https://passport.vml.com' } | |
request_token = consumer.get_request_token | |
access_token = request_token.get_access_token | |
response_body = JSON.parse(access_token.get("/api/user/jlongstreet/ui.json").body) | |
puts "#{response_body['field_preferred_name']['label']} #{response_body['field_last_name']['label']}" | |
puts response_body['mail'] | |
puts response_body['field_location']['label'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment