Skip to content

Client Obtain Token

nov edited this page Oct 3, 2014 · 17 revisions

Code Flow (Code Grant)

# Authorization Request
authorization_uri = client.authorization_uri(:scope => :user_about_me)
`open "#{authorization_uri}"`

# Authorization Response
puts "# Authorization Code"
code = gets.strip

# Token Request
client.authorization_code = code
client.access_token! # => Rack::OAuth2::AccessToken::Bearer (or other Rack::OAuth2::AccessTokens subclass)
Clone this wiki locally