Class OAuth2::Client
In: lib/oauth2/client.rb
Parent: Object

The OAuth2::Client class

Methods

Attributes

connection  [RW] 
id  [R] 
options  [RW] 
secret  [R] 
site  [RW] 

Public Class methods

Instantiate a new OAuth 2.0 client using the Client ID and Client Secret registered to your application.

@param [String] client_id the client_id value @param [String] client_secret the client_secret value @param [Hash] opts the options to create the client with @option opts [String] :site the OAuth2 provider site host @option opts [String] :authorize_url (’/oauth/authorize’) absolute or relative URL path to the Authorization endpoint @option opts [String] :token_url (’/oauth/token’) absolute or relative URL path to the Token endpoint @option opts [Symbol] :token_method (:post) HTTP method to use to request token (:get or :post) @option opts [Hash] :connection_opts ({}) Hash of connection options to pass to initialize Faraday with @option opts [FixNum] :max_redirects (5) maximum number of redirects to follow @option opts [Boolean] :raise_errors (true) whether or not to raise an OAuth2::Error

 on responses with 400+ status codes

@yield [builder] The Faraday connection builder

Public Instance methods

The authorize endpoint URL of the OAuth2 provider

@param [Hash] params additional query parameters

The Faraday connection object

Initializes an AccessToken by making a request to the token endpoint

@param [Hash] params a Hash of params for the token endpoint @param [Hash] access token options, to pass to the AccessToken object @return [AccessToken] the initalized AccessToken

The Resource Owner Password Credentials strategy

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

Makes a request relative to the specified site root.

@param [Symbol] verb one of :get, :post, :put, :delete @param [String] url URL path of request @param [Hash] opts the options to make the request with @option opts [Hash] :params additional query parameters for the URL of the request @option opts [Hash, String] :body the body of the request @option opts [Hash] :headers http request headers @option opts [Boolean] :raise_errors whether or not to raise an OAuth2::Error on 400+ status

  code response for this request.  Will default to client option

@option opts [Symbol] :parse @see Response::initialize @yield [req] The Faraday request

Set the site host

@param [String] the OAuth2 provider site host

The token endpoint URL of the OAuth2 provider

@param [Hash] params additional query parameters

[Validate]