Method: Hub::GitHubAPI::OAuth#apply_authentication
- Defined in:
- lib/hub/github_api.rb
#apply_authentication(req, url) ⇒ Object
301 302 303 304 305 306 307 308 309 310 311 |
# File 'lib/hub/github_api.rb', line 301 def apply_authentication req, url if req.path =~ %r{^(/api/v3)?/authorizations$} super else user = url.user ? CGI.unescape(url.user) : config.username(url.host) token = config.oauth_token(url.host, user) { obtain_oauth_token url.host, user } req['Authorization'] = "token #{token}" end end |