Could not retrieve a valid Token response from Token URL: Failed to validate oauth signature and token


#1

I am using Zend framework 2 and Twitter service class.
Trying to authenticate but Twitter shows the following error: “Could not retrieve a valid Token response from Token URL: Failed to validate oauth signature and token”.

Any idea?


#2

Hello,

Please make sure the time on your servers is correct. The system clock is used by the OAuth implementation and needs to be in sync with the Twitter servers. You can check the current time in the “Date” HTTP header returned with every request.

Read more about Troubleshooting OAuth 1.0A at https://dev.twitter.com/discussions/204 and please let us know if that fixes your issues.


#3

Thanks for your reply!
I will try and will keep you in touch!
:slight_smile:


#4

The HTTP header returned by our server is:

HTTP/1.1 401 Authorization Required
Date: Tue, 08 Apr 2014 13:51:20 GMT
Vary: Accept-Encoding
Server: Apache/2.2.22 (Ubuntu)
Connection: Keep-Alive
Content-Type: text/html; charset=iso-8859-1

The HTTP header returned by Twitter is:

HTTP/1.1 301 Moved Permanently
date: Tue, 08 Apr 2014 13:51:25 UTC
server: tfe
location: https://twitter.com/
Connection: Keep-Alive
set-cookie: guest_id=v1%3A139696508511751023; Domain=.twitter.com; Path=/; Expires=Thu, 07-Apr-2016 13:51:25 UTC
Content-Length: 0

The difference between both headers in time is less than 5 seconds but the timezone on our server is GMT, while it is set to UTC on Twitter???

Any idea?


#5

Actually I switched to 3rd-party library for Twitter oauth

Now it works fine for me! :slight_smile:

Just for info:
Even the time seems synchronized, Twitter service of Zend still returns the same error “Could not retrieve a valid Token response from Token URL: Failed to validate oauth signature and token”.