1. What is OAuth and why do I care? - token


#1

Hi, I can't get this the first exercise to work with any of the two tokens. Is there a new one?

  • token = "1c4b40471046fdb5d0ff81570c7564fe244940c2"
  • token = "e6a75d6b6d7b0fdd0eee93fd3c141d808852a0e9"

#2

Same not working for me too


#3

I got it to work with this code:

require 'httparty'

token = "1c4b40471046fdb5d0ff81570c7564fe244940c2"

user = HTTParty.get "https://api.github.com/user", 
    :headers => { 
                    "Authorization" => "token #{token}",
                    "User-Agent" => "codecademy"    
                }

puts "Hi, my username is api-padawan" it will work.

Don't put It will work in a string.


#5

I am also facing the same issue. Even after giving right token, I am getting an error.


#6

Not working for me either, error message: > "Oops, try again. It looks like your code didn't print the correct username! Click the red Reset button, then click run."

puts user gives the following hash:

{"message"=>"Bad credentials", "documentation_url"=>"https://developer.github.com/v3"}

Workaround solution posted by @javapro45590 does not fix it for me, either.

UPDATE: Temporary solution found. You have to intentionally produce a syntax error, for example put a comma at the end of a line. It'll display an error message, but it'll also show "Way to go!" and lets you move on.


#7

I was able to make this work via IRB using the same code (but my own GitHub API token). So code is ok, but exercise validator is not.


#8

Still broken, api-padawan's code doesn't work either.


#9

The correct token is used later on @ 4. Tokens up close

token = "c8196abdbdcf0e87fcd065d1e07cb2be7ecd682c"

Output:

Hi, my username is api-padawan
nil

New error...

Oops, try again.
Did you accidentally delete the token string? Click the red Reset button, then click Run!


#10

I'm getting this latest error too


#12

Still doesn't work with the default token, same error message.


#14