class OAuth2::Strategy::Password

The Resource Owner Password Credentials Authorization Strategy

@see tools.ietf.org/html/draft-ietf-oauth-v2-15#section-4.3

Public Instance Methods

authorize_url() click to toggle source

Not used for this strategy

@raise [NotImplementedError]

# 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 = {}) click to toggle source

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

@param [String] username the End User username @param [String] password the End User password @param [Hash] params additional params

# 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