Module: Octokit::Client::Tokens
Relationships & Source Files | |
Extension / Inclusion / Inheritance Descendants | |
Included In:
| |
Defined in: | lib/octokit/client/tokens.rb |
Overview
Method to check scopes
Instance Method Summary
-
#scopes(token = @access_token, options = {}) ⇒ Array<String>
Check scopes for a token.
Instance Method Details
#scopes(token = @access_token, options = {}) ⇒ Array
<String
>
Check scopes for a token
# File 'lib/octokit/client/tokens.rb', line 15
def scopes(token = @access_token, = {}) = .dup raise ArgumentError, 'Access token required' if token.nil? auth = { 'Authorization' => "token #{token}" } headers = ( .delete(:headers) || {}).merge(auth) agent.call(:get, 'user', headers: headers) .headers['X-OAuth-Scopes'] .to_s .split(',') .map(&:strip) .sort end