Class: OAuth2::Strategy::Password

Inherits:
Base
  • Object
show all
Defined in:
lib/oauth2/strategy/password.rb

Overview

The Resource Owner Password Credentials Authorization Strategy

Instance Method Summary collapse

Methods inherited from Base

#client_params, #initialize

Constructor Details

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

Instance Method Details

#authorize_urlObject

Not used for this strategy

Raises:

  • (NotImplementedError)


10
11
12
# File 'lib/oauth2/strategy/password.rb', line 10

def authorize_url
  fail(NotImplementedError, 'The authorization endpoint is not used in this strategy')
end

#get_token(username, password, params = {}, opts = {}) ⇒ Object

Retrieve an access token given the specified End User username and password.



19
20
21
22
23
24
# File 'lib/oauth2/strategy/password.rb', line 19

def get_token(username, password, params = {}, opts = {})
  params = {'grant_type' => 'password',
            'username'   => username,
            'password'   => password}.merge(client_params).merge(params)
  @client.get_token(params, opts)
end