class Oauthio::Strategy::AuthCode

Public Class Methods

new(client) click to toggle source
# File lib/oauthio/strategy/auth_code.rb, line 4
def initialize(client)
  @client = client
end

Public Instance Methods

authorize_params(params={}) click to toggle source

The required query parameters for the authorize URL

@param [Hash] params additional query parameters

# File lib/oauthio/strategy/auth_code.rb, line 18
def authorize_params(params={})
  params.merge('k' => @client.id)
end
authorize_url(provider, params = {}) click to toggle source

The authorization URL endpoint of the provider

@param [Hash] params additional query parameters for the URL

# File lib/oauthio/strategy/auth_code.rb, line 11
def authorize_url(provider, params = {})
  @client.authorize_url(provider, authorize_params.merge(params))
end
client_params() click to toggle source

The OAuth client_id and client_secret

@return [Hash]

# File lib/oauthio/strategy/auth_code.rb, line 25
def client_params
  {'key' => @client.id, 'secret' => @client.secret}
end
get_token(code, params = {}, opts = {}) click to toggle source

Retrieve an access token given the specified validation code.

@param [String] code The Authorization Code value @param [Hash] params additional params @param [Hash] opts options @note that you must also provide a :redirect_uri with most OAuth 2.0 providers

# File lib/oauthio/strategy/auth_code.rb, line 35
def get_token(code, params = {}, opts = {})
  params = {'code' => code}.merge(client_params).merge(params)
  @client.get_token(params, opts)
end