Class: Square::OAuth2

Inherits:
Object
  • Object
show all
Defined in:
lib/square/http/auth/o_auth2.rb

Overview

Utility class for OAuth 2 authorization and token management.

Class Method Summary collapse

Class Method Details

.apply(config, http_request) ⇒ Object

Add OAuth2 authentication to the http request. be added.

Parameters:

  • The (HttpRequest)

    HttpRequest object to which authentication will



7
8
9
10
# File 'lib/square/http/auth/o_auth2.rb', line 7

def self.apply(config, http_request)
  token = config.access_token
  http_request.headers['Authorization'] = "Bearer #{token}"
end