Skip to content

Instantly share code, notes, and snippets.

@ledestin
Created March 13, 2016 10:36
Show Gist options
  • Save ledestin/a75422ff706f79fcf2d4 to your computer and use it in GitHub Desktop.
Save ledestin/a75422ff706f79fcf2d4 to your computer and use it in GitHub Desktop.
# Exchange a provided OAuth code for an OAuth access token, 'expires in'
# value, and refresh token.
def self.exchange_token(client_id, client_secret, redirect_uri, code)
response = request_token(client_id, client_secret, redirect_uri, code)
fail_on_erroneous_response(response,
"Error exchanging code for access token")
TokenResponse.from_hash(response)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment