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

OAuth2 Forum

View Course » View Exercise

2305 points
Submitted by
about 5 years ago

Something wrong with this exercise.

This was my code:

require 'httparty'
require 'json'

token = "e6a75d6b6d7b0fdd0eee93fd3c141d808852a0e9"
request_headers = {"Authorization" => "token: #{token}"}

response = HTTParty.get "", 
         :headers => request_headers

puts response

I get this as the response:

{"message"=>"Bad credentials"}

The reason I am checking just response is because response.headers["X-OAuth-Scopes"] gave me a nil as the response even though the code passed.

3 votes


try this

require 'httparty'
require 'json'

token = "e6a75d6b6d7b0fdd0eee93fd3c141d808852a0e9"

response = HTTParty.get "",
:headers => {
"Authorization" => "token #{token}",
"User-Agent" => "codecademy"


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

982 points
Submitted by
Vasilis Spilka
almost 5 years ago


3790335aba1e1e2d72afb2a043f6e8ef?s=140&d=retro zechino almost 5 years ago

Separate the 'requires'

595685279ad7f5be150002c6_951960925 mezbah alam almost 5 years ago

its work .but i can't understand!!

53c963d9282ae3e81b00051f_841453022 Michael Rizzo almost 4 years ago

The api behind the lesson is is broken. copy and paste the example and seperate the requires.