ruby

Ruby code posted
created at 15 Feb 21:57

Edit | Back
1
2
3
4
5
6
7
8
OAUTH2_SITE = 'https://foo'
RESOURCE_OWNER_USERNAME = 'user@example.com'
RESOURCE_OWNER_PASSWORD = 'password'

client = OAuth2::Client.new(CLIENT_ID, CLIENT_SECRET, site: OAUTH2_SITE)
token = client.password.get_token(EMAIL, PASSWORD)
response = token.get(api_url)
puts JSON.pretty_generate(JSON.parse(response.body))
326 Bytes in 2 ms with coderay