class OAuth2Client::Grant::AuthorizationCode
Authorization Code Grant
@see tools.ietf.org/html/draft-ietf-oauth-v2-31#section-4.1
Public Instance Methods
get_token(code, opts={})
click to toggle source
Retrieve an access token for a given auth code
@param [String] code refresh token @param [Hash] params additional params @param [Hash] opts options
# File lib/oauth2-client/grant/authorization_code.rb, line 50 def get_token(code, opts={}) opts[:params] = { :grant_type => grant_type, :code => code }.merge(opts.fetch(:params, {})) opts[:authenticate] ||= :headers method = opts.delete(:method) || :post make_request(method, token_path, opts) end
grant_type()
click to toggle source
# File lib/oauth2-client/grant/authorization_code.rb, line 11 def grant_type "authorization_code" end
response_type()
click to toggle source
# File lib/oauth2-client/grant/authorization_code.rb, line 7 def response_type "code" end
token_path(params={})
click to toggle source
Access Token Request @see tools.ietf.org/html/draft-ietf-oauth-v2-31#section-4.1.3
# File lib/oauth2-client/grant/authorization_code.rb, line 29 def token_path(params={}) unless params.empty? return "#{@token_path}?#{to_query(params)}" end @token_path end