Skip to content

Instantly share code, notes, and snippets.

@joelongstreet
Last active January 2, 2016 12:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joelongstreet/8307390 to your computer and use it in GitHub Desktop.
Save joelongstreet/8307390 to your computer and use it in GitHub Desktop.
a sample of how to use oauth with VML's passport product
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