This forum is now read-only. Please use our new forums at discuss.codecademy.com.

OAuth2 Forum

View Course » View Exercise

1387 points
54f47f79e39efe646d00727f_646434108
Submitted by
Hunter Steele
about 2 years ago

what is the answer to this excercise?

this code does not work for me.
please help

require 'httparty' 
require 'json'

token = "e6a75d6b6d7b0fdd0eee93fd3c141d808852a0e9"

response = HTTParty "https://api.github.com"
  endpoint = "https://api-github.com/user"
  respone.headers["X-Accepted-OAuth-Scopes"]

print response.headers["X-OAuth-Scopes"]

1 vote

permalink

This code works for me:

require 'httparty'
require 'json'

"Authorization" => "token: #{token}"
token = "e6a75d6b6d7b0fdd0eee93fd3c141d808852a0e9"
request_headers = {"User-Agent" => "codecademy"}

response = HTTParty.get "https://api.github.com/user"",
print response.headers["X-Accepted-OAuth-Scopes"]
:headers => request_headers

1452 points
5516442286f55270b70009fc_473943152
Submitted by
Felipe
about 2 years ago