Sha256: bd7b638fac8b4b7e5e5d6967b1733c2f8d19476fd5b1b937d348a9833b5bbc39

Contents?: true

Size: 681 Bytes

Versions: 5

Compression:

Stored size: 681 Bytes

Contents

require "base64"

module OAuth2
  module Grant
    # Client Credentials Grant
    #
    # @see http://tools.ietf.org/html/draft-ietf-oauth-v2-31#section-4.4
    class ClientCredentials < Base

      def grant_type 
        "client_credentials"
      end

      # Retrieve an access token for the given client credentials
      #
      # @param [Hash] params additional params
      # @param [Hash] opts options
      def get_token(opts={})
        opts[:params] ||= {}
        opts[:params][:grant_type] = grant_type
        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/client_credentials.rb
oauth2-client-1.1.2 lib/oauth2/grant/client_credentials.rb
oauth2-client-1.1.1 lib/oauth2/grant/client_credentials.rb
oauth2-client-1.1.0 lib/oauth2/grant/client_credentials.rb
oauth2-client-1.0.0 lib/oauth2/grant/client_credentials.rb