Failed to validate oauth signature and token

133 views
Skip to first unread message

computerzworld

unread,
Nov 11, 2010, 8:36:45 AM11/11/10
to Twitter Development Talk
Hello,
I am using Twitter Oauth library for signing in to Twitter
& getting access token for posting tweets programatically. But when I
am trying to run the application on my server it is giving me error
like

"Failed to validate oauth signature and token"

I tried to move the application on another server & it is working. So
what should be the problem behind this? Is there any configuration
required for the server in order to make this work? Please help me.


Thanks in advance.

Abraham Williams

unread,
Nov 11, 2010, 2:28:49 PM11/11/10
to twitter-deve...@googlegroups.com
Your servers clock needs to be properly synced using NTP.

http://en.wikipedia.org/wiki/Network_Time_Protocol

Abraham
-------------
Abraham Williams | Hacker Advocate | abrah.am
@abraham | github.com/abraham | blog.abrah.am
This email is: [ ] shareable [x] ask first [ ] private.




--
Twitter developer documentation and resources: http://dev.twitter.com/doc
API updates via Twitter: http://twitter.com/twitterapi
Issues/Enhancements Tracker: http://code.google.com/p/twitter-api/issues/list
Change your membership to this group: http://groups.google.com/group/twitter-development-talk

computerzworld

unread,
Nov 19, 2010, 5:22:11 AM11/19/10
to Twitter Development Talk
Thanks for your reply. Is there anyway to sync server clock
programatically? Or any other way by which we can make the stuff
working? Because I don't have access to server hardware.

On Nov 12, 12:28 am, Abraham Williams <4bra...@gmail.com> wrote:
> Your servers clock needs to be properly synced using NTP.
>
> http://en.wikipedia.org/wiki/Network_Time_Protocol
>
> Abraham
> -------------
> Abraham Williams | Hacker Advocate | abrah.am
> @abraham <https://twitter.com/abraham> | github.com/abraham | blog.abrah.am
> This email is: [ ] shareable [x] ask first [ ] private.
>

M. Edward (Ed) Borasky

unread,
Nov 19, 2010, 12:35:23 PM11/19/10
to twitter-deve...@googlegroups.com, computerzworld, Twitter Development Talk
The server administrators can and should sync server clocks
automatically to the world time clocks using Network Time Protocol
(NTP). If your "IT department" isn't doing this, find out why not.
Most likely they don't know it's possible. It's pretty easy on Linux
and Windows, but you do need an Internet connection to the outside
world, so the firewall folks need to be involved and you have to make
sure your server-side NTP software is kept up to date on security
patches.
--
M. Edward (Ed) Borasky
http://borasky-research.net http://twitter.com/znmeb

"A mathematician is a device for turning coffee into theorems." - Paul Erdos

Matt Harris

unread,
Nov 19, 2010, 1:55:26 PM11/19/10
to twitter-deve...@googlegroups.com
In addition, the server time is returned in the HEAD of every response from the Twitter API. If the first request fails you can inspect the time returned in the HEAD and calculate the difference between it and your local time. You can then add/subtract that difference to the timestamp you use for OAuth requests.

Hope that helps,
@themattharris
Developer Advocate, Twitter
http://twitter.com/themattharris

computerzworld

unread,
Nov 20, 2010, 12:26:21 AM11/20/10
to Twitter Development Talk
@ Matt Harris
I checked the header from twitter & my server's
header & I found difference of 1 hour & I have set the time using
date_default_timezone_set to GMT using PHP. But still its giving the
same error. What should be the problem behind it? Thanks.

On Nov 19, 11:55 pm, Matt Harris <thematthar...@twitter.com> wrote:
> In addition, the server time is returned in the HEAD of every response from
> the Twitter API. If the first request fails you can inspect the time
> returned in the HEAD and calculate the difference between it and your local
> time. You can then add/subtract that difference to the timestamp you use for
> OAuth requests.
>
> Hope that helps,
> @themattharris
> Developer Advocate, Twitterhttp://twitter.com/themattharris
>
> On Fri, Nov 19, 2010 at 9:35 AM, M. Edward (Ed) Borasky <
>
> zn...@borasky-research.net> wrote:
> > The server administrators can and should sync server clocks automatically
> > to the world time clocks using Network Time Protocol (NTP). If your "IT
> > department" isn't doing this, find out why not. Most likely they don't know
> > it's possible. It's pretty easy on Linux and Windows, but you do need an
> > Internet connection to the outside world, so the firewall folks need to be
> > involved and you have to make sure your server-side NTP software is kept up
> > to date on security patches.
> >  --
> > M. Edward (Ed) Borasky
> >http://borasky-research.nethttp://twitter.com/znmeb
>
> > "A mathematician is a device for turning coffee into theorems." - Paul
> > Erdos
>

computerzworld

unread,
Nov 20, 2010, 12:45:15 AM11/20/10
to Twitter Development Talk
Problem solved! I have synchronized my server time to NTM using WHM &
it worked! Thanks all for your help.

computerzworld

unread,
Nov 20, 2010, 7:42:27 AM11/20/10
to Twitter Development Talk
I am facing the problem again even after server time sync. Getting the
same error again. Now what should be the issue? I am getting stuck
again :(
Reply all
Reply to author
Forward
0 new messages