Skip to content

Instantly share code, notes, and snippets.

@ismasan
Created October 7, 2013 18:14
Show Gist options
  • Select an option

  • Save ismasan/6872483 to your computer and use it in GitHub Desktop.

Select an option

Save ismasan/6872483 to your computer and use it in GitHub Desktop.
Interact with Bootic auth and API using the oauth2 gem.
require 'oauth2'
# Instantiate client
client = OAuth2::Client.new(
ENV['BOOTIC_CLIENT_ID'],
ENV['BOOTIC_CLIENT_SECRET'],
site: 'https://api.bootic.net',
authorize_url:'https://auth.bootic.net/oauth/authorize',
token_url:'https://auth.bootic.net/oauth/token'
)
# Get token - user password flow
token = client.password.get_token('booticjm', 'booticjm')
# Get data from API
resp = token.get('/v1/me')
resp.status # => 200
resp.parsed # => {'user_info' => {...}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment