Ajax-loader-large-white
OAuth2
Checking the scopes on a token

In the first exercise of this course we used an access token to authenticate and get the user info for the token's owner. What if we wanted to see what level of access this token provides for that user?

The GitHub API returns this information in each API call via the "X-OAuth-Scopes" header. Let's adapt the code from that first exercise to check the scopes on our token.

Instructions

Set the "Authorization" request header to "token e6a75d6b6d7b0fdd0eee93fd3c141d808852a0e9" and print the value of the "X-OAuth-Scopes" response header.

?
Stuck? Get a hint! Hint
Get live, fast support from Codecademy Advisors when you get stuck. Learn more.

Add "Authorization" => "token: #{token}" to the hash on line 4.

Add print response.headers["X-OAuth-Scopes" on line 9.

script.rb