This forum is now read-only. Please use our new forums! Go to forums

banner
Close banner
0 points
Submitted by Z118
about 11 years

I'm getting a 401 error with the Sending a Tweet lesson

I re-copied the tokens and secrets after changing the access level to “read and write”, but they’re the same as before. I’ve clicked the “Recreate my access token” button, but it still generates the same token.

I update the text in the status field before I click run every time so it’s not repeating a tweet, but I still get this 401 error message:

“The response code should be ‘200’ but you received ‘401’. Double check the credentials you passed to the OAuth library. Make sure that you changed your application to ‘Read and Write’ and copied the NEW values for your consumer and access tokens.”

I’ve done both of the things this message tells me to do, but still no dice. Please help. Thanks.

Answer 513ba55bb872c9b4e100265f

0 votes

Permalink

Finally got it. Just refreshed everything a bunch and re-copied the keys, tokens, and secrets from the OAuth tab instead of the details tab…

points
Submitted by Z118
about 11 years

Answer 513dec3948c970ff340076e4

0 votes

Permalink

Go back into dev.twitter.com, and make sure RESET your access tokens (on the front of the dev page) AFTER you change it to Read/Write.

points
about 11 years

Answer 513df170d1d035416a0077f9

0 votes

Permalink

Have you hit the “re-create tokens” button on the bottom? Try doing that and then copying all four codes from the OAuth tab instead of the details tab. Also, change the message your are trying to tweet every time before you hit run, otherwise I think Twitter recognizes you as a bot double-tweeting and send you a 401. That’s what worked for me. Good luck!

points
Submitted by Z118
about 11 years

Answer 518a8a204d6c94914f000c7c

0 votes

Permalink

Set up Net::HTTP to use SSL, which is required by Twitter.

http = Net::HTTP.new address.host, address.port http.use_ssl = true http.verify_mode = OpenSSL::SSL::VERIFY_PEER

you need: http.use_ssl = false

points
Submitted by Giovanni Almeida
almost 11 years