class OAuth2Client::Grant::Implicit

Implicit Grant @see tools.ietf.org/html/draft-ietf-oauth-v2-31#section-4.2

Public Instance Methods

get_token(opts={}) click to toggle source

Retrieve an access token given the specified client.

@param [Hash] params additional params @param [Hash] opts options

# File lib/oauth2-client/grant/implicit.rb, line 28
def get_token(opts={})
  opts[:params] ||= {}
  opts[:params].merge!(token_params)
  opts[:authenticate] ||= :headers
  method = opts.delete(:method) || :get
  make_request(method, @token_path, opts)
end
response_type() click to toggle source
# File lib/oauth2-client/grant/implicit.rb, line 7
def response_type
  "token"
end
token_path(params={}) click to toggle source

Generate a token path using the given parameters .

@param [Hash] query parameters

# File lib/oauth2-client/grant/implicit.rb, line 14
def token_path(params={})
  params = params.merge(token_params)
  "#{@authorize_path}?#{to_query(params)}"
end
token_url(params={}) click to toggle source
# File lib/oauth2-client/grant/implicit.rb, line 19
def token_url(params={})
  params = params.merge(token_params)
  build_url(host, :path => authorize_path, :params => params)
end

Private Instance Methods

token_params() click to toggle source
# File lib/oauth2-client/grant/implicit.rb, line 38
def token_params
  {
    :response_type => response_type,
    :client_id  => @client_id
  }
end