Getting Could not authenticate you (code 32) when using scribe to access Twitter

560 views Asked by At

Update: I have found the problem There is a line in TwitterExample.java file

request.addBodyParameter("status", "this is sparta! *");

Remove it and it works!

I'm trying to run the scribe Twitter example but I'm getting this error:

{"errors":[{"message":"Could not authenticate you","code":32}]}

The console in debug mode is as follow:

=== Twitter's OAuth Workflow ===

Fetching the Request Token...
obtaining request token from http://api.twitter.com/oauth/request_token
setting oauth_callback to oob
generating signature...
using base64 encoder: CommonsCodec
base string is: POST&http%3A%2F%2Fapi.twitter.com%2Foauth%2Frequest_token&oauth_callback%3Doob%26oauth_consumer_key%3DGekT85UT5ZqM6vBx198hSA%26oauth_nonce%3D1790561433%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1387217347%26oauth_version%3D1.0
signature is: cfJaLyEJePyHOWMm0ffYwQDEIcs=
appended additional OAuth parameters: { oauth_callback -> oob , oauth_signature -> cfJaLyEJePyHOWMm0ffYwQDEIcs= , oauth_version -> 1.0 , oauth_nonce -> 1790561433 , oauth_signature_method -> HMAC-SHA1 , oauth_consumer_key -> GekT85UT5ZqM6vBx198hSA , oauth_timestamp -> 1387217347 }
using Http Header signature
sending request...
response status code: 200
response body: oauth_token=y67RW5fscLt4tjCss2DPWGb7CZsMpTzCkvGgisExTms&oauth_token_secret=R79S0QN6iBw2qzmldy6C5eUXtMJR5K8wPtp5bIPhuY&oauth_callback_confirmed=true
Got the Request Token!

Now go and authorize Scribe here:
https://api.twitter.com/oauth/authorize?oauth_token=y67RW5fscLt4tjCss2DPWGb7CZsMpTzCkvGgisExTms
And paste the verifier here
>>9417650

Trading the Request Token for an Access Token...
obtaining access token from http://api.twitter.com/oauth/access_token
setting token to: Token[y67RW5fscLt4tjCss2DPWGb7CZsMpTzCkvGgisExTms , R79S0QN6iBw2qzmldy6C5eUXtMJR5K8wPtp5bIPhuY] and verifier to: org.scribe.model.Verifier@f4a24a
generating signature...
using base64 encoder: CommonsCodec
base string is: POST&http%3A%2F%2Fapi.twitter.com%2Foauth%2Faccess_token&oauth_consumer_key%3DGekT85UT5ZqM6vBx198hSA%26oauth_nonce%3D3011227504%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1387217405%26oauth_token%3Dy67RW5fscLt4tjCss2DPWGb7CZsMpTzCkvGgisExTms%26oauth_verifier%3D9417650%26oauth_version%3D1.0
signature is: JY7v+HVY/RCikbDMzUu8zxwzurU=
appended additional OAuth parameters: { oauth_signature -> JY7v+HVY/RCikbDMzUu8zxwzurU= , oauth_version -> 1.0 , oauth_nonce -> 3011227504 , oauth_signature_method -> HMAC-SHA1 , oauth_consumer_key -> GekT85UT5ZqM6vBx198hSA , oauth_token -> y67RW5fscLt4tjCss2DPWGb7CZsMpTzCkvGgisExTms , oauth_verifier -> 9417650 , oauth_timestamp -> 1387217405 }
using Http Header signature
Got the Access Token!
(if your curious it looks like this: Token[2247766357-5B5twxFPbqxUjnXYoWjWAM4Z0ARQyr24JAQs818 , uDOHmJhPbJy5oDj8AqiSyBudfODwOIYC2rmcD9sG9eHfX] )

Now we're going to access a protected resource...
signing request: https://api.twitter.com/1.1/account/settings.json
setting token to: Token[2247766357-5B5twxFPbqxUjnXYoWjWAM4Z0ARQyr24JAQs818 , uDOHmJhPbJy5oDj8AqiSyBudfODwOIYC2rmcD9sG9eHfX]
generating signature...
using base64 encoder: CommonsCodec
base string is: GET&https%3A%2F%2Fapi.twitter.com%2F1.1%2Faccount%2Fsettings.json&oauth_consumer_key%3DGekT85UT5ZqM6vBx198hSA%26oauth_nonce%3D2104164290%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1387217405%26oauth_token%3D2247766357-5B5twxFPbqxUjnXYoWjWAM4Z0ARQyr24JAQs818%26oauth_version%3D1.0%26status%3Dthis%2520is%2520sparta%2521%2520%252A
signature is: 0r6zCvdrsb8t8oomNrfu1VjzZKU=
appended additional OAuth parameters: { oauth_signature -> 0r6zCvdrsb8t8oomNrfu1VjzZKU= , oauth_version -> 1.0 , oauth_nonce -> 2104164290 , oauth_signature_method -> HMAC-SHA1 , oauth_consumer_key -> GekT85UT5ZqM6vBx198hSA , oauth_token -> 2247766357-5B5twxFPbqxUjnXYoWjWAM4Z0ARQyr24JAQs818 , oauth_timestamp -> 1387217405 }
using Http Header signature
Got it! Lets see what we found...

{"errors":[{"message":"Could not authenticate you","code":32}]}

Thats it man! Go and build something awesome with Scribe! :)
0

There are 0 answers