Class: OAuth2::Grant::Implicit

Inherits:
Base
  • Object
show all
Defined in:
lib/oauth2/grant/implicit.rb

Overview

Implicit Grant

Instance Attribute Summary

Attributes inherited from Base

#authorize_path, #client_id, #client_secret, #connection, #device_path, #host

Instance Method Summary collapse

Methods inherited from Base

#initialize, #make_request

Methods included from UrlHelper

#build_url, #generate_timestamp, #generate_urlsafe_key, http_basic_encode, #to_query

Constructor Details

This class inherits a constructor from OAuth2::Grant::Base

Instance Method Details

#get_token(opts = {}) ⇒ Object

Retrieve an access token given the specified client.

Parameters:

  • params (Hash)

    additional params

  • opts (Hash) (defaults to: {})

    options



28
29
30
31
32
33
34
# File 'lib/oauth2/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_typeObject



7
8
9
# File 'lib/oauth2/grant/implicit.rb', line 7

def response_type
  "token"
end

#token_path(params = {}) ⇒ Object

Generate a token path using the given parameters .

Parameters:

  • query (Hash)

    parameters



14
15
16
17
# File 'lib/oauth2/grant/implicit.rb', line 14

def token_path(params={})
  params = params.merge(token_params)
  "#{@authorize_path}?#{to_query(params)}"
end

#token_url(params = {}) ⇒ Object



19
20
21
22
# File 'lib/oauth2/grant/implicit.rb', line 19

def token_url(params={})
  params = params.merge(token_params)
  build_url(host, :path => authorize_path, :params => params)
end