HI Rajat,

Double check the time on your machine is in sync with the Twitter servers
(GMT). If the timestamp is too far from Twitter's server time OAuth will not
work.

Also, check the body content of the 403 response. It often contains
information that can help diagnose connection problems.

Best
@themattharris
Developer Advocate, Twitter
http://twitter.com/themattharris


On Tue, Nov 23, 2010 at 8:38 PM, rajat <[email protected]> wrote:

> I am sending AJAX request to acquire a request token but getting 403
> Forbidden error. I am putting following example to show my approach
>
> Available info :
> ---------------------------------------------------
> 1. Consumer Key : abckey
> 2. Consumer secret : xyzsecret
> 3. Request token URL : https://api.twitter.com/oauth/request_token
> 4. Registered OAuth Callback URL : http://127.0.0.1/twitter/index.html
> 5. Access Token (oauth_token) : 1234-efghaccess
> 6. Access Token Secret (oauth_token_secret) : mnopqrstaccesssecret
>
> My Javascript code
>
> --------------------------------------------------------------------------------------------------------------------------------------------------------------------
> var today = new Date();
> var ts = Math.round(today.getTime()/1000.0);
>
> xmlhttp=getxmlhttobject();
> url = "http://api.twitter.com/oauth/request_token";;
> xmlhttp.open("POST", url, true);
> xmlhttp.setRequestHeader("Authorization","OAuth oauth_nonce=
> \"126weOPUDSBLS02dXTlp5tYjv434FE9ALwKILYFIU\", oauth_signature_method=
> \"HMAC-SHA1\", oauth_timestamp=\""+ ts +"\", oauth_consumer_key=
> \"abckey\", oauth_token=\"1234-efghaccess\", oauth_signature=
> \"mnopqrstaccesssecret\" , oauth_version=\"1.0\"");
> xmlhttp.send(null);
>
> -------------------------------------------------------------------------------------------------------------------------------------------------------------------
> When i check live headers in mozilla i get status as 403 Forbidden
> error.
>
> Can anyone guide me where i am doing wrong..
>
> Thank you.
>
>
> --
> 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
>

-- 
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

Reply via email to