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

OAuth2 Forum

View Course » View Exercise

432 points
Picture
Submitted by
Mick Ryan
about 4 years ago

Course not passing even though seems to be verbatim

This module is not working for me, I have followed it verbatim but still not working. Upon using inspect, it seems the API may have changed?

require 'httparty'
require 'json'

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

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

The output if print response.headers.inspect

{"date"=>["Wed, 13 Nov 2013 23:21:04 GMT"], "server"=>["GitHub.com"], "content-type"=>["application/json; charset=utf-8"], "status"=>["200 OK"], "x-ratelimit-limit"=>["60"], "x-ratelimit-remaining"=>["46"], "x-ratelimit-reset"=>["1384387867"], "cache-control"=>["public, max-age=60, s-maxage=60"], "etag"=>["\"554172d8bae635ac74f5c444a996b6b2\""], "vary"=>["Accept,Accept-Encoding"], "x-github-media-type"=>["github.beta; format=json"], "x-content-type-options"=>["nosniff"], "content-length"=>["1781"], "access-control-allow-credentials"=>["true"], "access-control-expose-headers"=>["ETag, Link, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes"], "access-control-allow-origin"=>["*"], "x-github-request-id"=>["32138FCC:549F:16663E1:52840960"], "via"=>["1.1 api.github.com"], "connection"=>["close"]}nil

0 votes

permalink

I think you are probably right that the API since the course was created, that and the fact that the person who created the course hasn't been active on the site in a couple of months tells me that the course will remain broken I'm afraid.

352 points
518586f6542328aa160016de_925806369
Submitted by
Seán Collins
over 3 years ago

1 Comment

7edd33c5b7435cddbc142b68626d09d8?s=140&d=retro Heliogábalo Santos over 2 years ago

i think that you just need to change the token in your code by the token sugested.