Sha256: 217059a0d2a883525d55497be7c00eca217b88a25a84a4708593f931b40729d6

Contents?: true

Size: 696 Bytes

Versions: 5

Compression:

Stored size: 696 Bytes

Contents

module OAuth2
  module Grant
    class Password < Base

      def grant_type
        'password'
      end

      # Retrieve an access token given the specified client.
      #
      # @param username
      # @param password
      # @param [Hash] params additional params
      # @param [Hash] opts options
      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
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
oauth2-client-1.1.3 lib/oauth2/grant/password.rb
oauth2-client-1.1.2 lib/oauth2/grant/password.rb
oauth2-client-1.1.1 lib/oauth2/grant/password.rb
oauth2-client-1.1.0 lib/oauth2/grant/password.rb
oauth2-client-1.0.0 lib/oauth2/grant/password.rb