class Square::OAuth2

Utility class for OAuth 2 authorization and token management.

Public Class Methods

apply(config, http_request) click to toggle source

Add OAuth2 authentication to the http request. @param [HttpRequest] The HttpRequest object to which authentication will be added.

# 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