octokit.rb icon indicating copy to clipboard operation
octokit.rb copied to clipboard

[FEAT]: Read `x-oauth-scopes` returned from the API

Open yeikel opened this issue 1 year ago • 1 comments

Describe the need

I would like to read x-oauth-scopes returned from the API headers to make decisions

I could not find any native method to do this with octokit but I could be wrong

I am currently implementing it with the following snippet :


response = HTTParty.get(
  "https://#{ENV['GITHUB_ENTERPRISE_HOSTNAME']}/api/v3/user",
  :headers => {
    "Authorization" => "Bearer #{ENV["GITHUB_ENTERPRISE_ACCESS_TOKEN"]}"
  })

scopes = response.headers['x-oauth-scopes']

SDK Version

No response

API Version

No response

Relevant log output

No response

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct

yeikel avatar Mar 17 '23 14:03 yeikel