Sha256: 72459558037b6734f9d57182f49f7e2244194892222adf60e81c68b7c62e4721

Contents?: true

Size: 687 Bytes

Versions: 1

Compression:

Stored size: 687 Bytes

Contents

require "base64"

module OAuth2Client
  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

1 entries across 1 versions & 1 rubygems

Version Path
oauth2-client-2.0.0 lib/oauth2-client/grant/client_credentials.rb