Skip to content

Instantly share code, notes, and snippets.

@daryllxd
Created May 5, 2014 15:20
Show Gist options
  • Save daryllxd/11539693 to your computer and use it in GitHub Desktop.
Save daryllxd/11539693 to your computer and use it in GitHub Desktop.
def generate_tokens(code)
data = {
client_id: client_id,
client_secret: client_secret,
redirect_uri: callback_url,
code: code
}
response = connection.post do |request|
request.url '/login/oauth/access_token'
request.params = data
end
if response.status.eql?(200)
Rack::Utils.parse_nested_query(response.body)
else
{ error: response.status }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment