hi rajat... even me to was getting 401 error.. but its resolved.. during registering your application to twitter you need to give callback url... like http://localhost:8080.
i have done this using java... so my code is: String CallbackURL=" http://localhost:8080/tweetproj/index.jsp"; where tweetproj is my project name and index.jsp is just one jsp page... Hope this may helps u... if u have doubts, u r welcome On Wed, Nov 24, 2010 at 10:08 AM, 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 > -- Regards, Deepa -- 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
