Class: OAuth2::Strategy::ClientCredentials — Documentation by YARD 0.9.45

# Class: OAuth2::Strategy::ClientCredentials

Inherits:
  Base
  - Object
  - Base
  - OAuth2::Strategy::ClientCredentials
  show all

Defined in:
  lib/oauth2/strategy/client_credentials.rb

## Overview

The Client Credentials Strategy

See Also:

- http://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-15#section-4.4

## Instance Method Summary collapse

- #authorize_url ⇒ Object

  Not used for this strategy.

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

  Retrieve an access token given the specified client.

### Methods inherited from Base

#initialize

## Constructor Details

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

## Instance Method Details

### #authorize_url ⇒ `Object`

Not used for this strategy

Raises:

- (`NotImplementedError`)

    12
    13
    14
    # File 'lib/oauth2/strategy/client_credentials.rb', line 12

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

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

Retrieve an access token given the specified client.

Parameters:

- params (`Hash`) (defaults to: `{}`) —

  additional params

- opts (`Hash`) (defaults to: `{}`) —

  options

    20
    21
    22
    23
    # File 'lib/oauth2/strategy/client_credentials.rb', line 20

    def get_token(params = {}, opts = {})
      params = params.merge("grant_type" => "client_credentials")
      @client.get_token(params, opts)
    end