Class: OAuth2::Grant::Password
- Defined in:
- lib/oauth2/grant/password.rb
Instance Attribute Summary
Attributes inherited from Base
#authorize_path, #client_id, #client_secret, #connection, #device_path, #host, #token_path
Instance Method Summary collapse
-
#get_token(username, password, opts = {}) ⇒ Object
Retrieve an access token given the specified client.
- #grant_type ⇒ Object
Methods inherited from Base
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(username, password, opts = {}) ⇒ Object
Retrieve an access token given the specified client.
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/oauth2/grant/password.rb', line 15 def get_token(username, password, opts={}) opts[:params] ||= {} opts[:params].merge!({ :grant_type => grant_type, :username => username, :password => password }) opts[:authenticate] ||= :headers method = opts.delete(:method) || :post make_request(method, @token_path, opts) end |
#grant_type ⇒ Object
5 6 7 |
# File 'lib/oauth2/grant/password.rb', line 5 def grant_type 'password' end |