[twitter-dev] Re: Twitter API OAuth Questions - (401) Unauthorized error when posting status
Thanks. I ended up copying the final url and pasting it into my browser. I was then able to see that it was complaining about the nonce. I changed it to use a GUID instead of a random number, since a random number could reproduce the same numbers. That seemed to have fixed my problem. On Sep 24, 12:14 pm, chad wrote: > Hello, > > It looks like your base string is formatted correctly to generate the > signature. Not sure if you displayed the final URL for clarity, but > since sending a status update requires a POST, you need to put all of > the parameters in the body of the POST request instead of in the URL > query string. > > Thanks, > -Chad > > > > On Thu, Sep 24, 2009 at 10:16 AM, eclipsed4utoo > wrote: > > > So after battling OAuth, I finally was able to get an access token. > > But now, I am getting a 401 Unauthorized error when trying to post the > > status. > > > My question is, what parameters do I need to send for posting a > > status? All parameters(consumer key, consumer secret, token, token > > secret, nonce, timestamp, signature method, version)? Does that > > status go as a parameter, or is it written to the request like done > > with Basic Authentication? If it goes as a parameter, does it go as a > > parameter that is part of the signature, or is it tacked on at the end > > after the signature? I am doing a desktop app, so I have the PIN. > > Does the PIN need to also be a parameter to update the status? > > > With this generic message, it's hard for me to figure out what I am > > doing wrong. I don't know if I am missing parameters, have too many > > parameters, or something that has nothing to do with the parameters. > > I am using .Net, which is throwing an exception when trying to get the > > response. All I can see is "(401) Unauthorized". > > > I tried going by the OAuth core documentation for accessing protected > > resources: > > >http://oauth.net/core/1.0#anchor13 > > > but still get the same error. > > > Here is my POST data for updating a status: > > > POST&http%3A%2F%2Ftwitter.com%2Fstatuses > > %2Fupdate.xml&oauth_consumer_key%3Dr1asAzyH1Kyq4BWE8ZlEg%26oauth_nonce > > %3D773772%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp > > %3D1253801265%26oauth_token%3D65084988- > > fQr5UVeZ6TDLZ9DQp7hEkOT0lXtAUUNp3AbYnCX8F%26oauth_version > > %3D1.0%26status%3DHelloWorld > > > and my final URL looks like... > > >http://twitter.com/statuses/update.xml?oauth_consumer_key=r1asAzyH1Ky...
[twitter-dev] Re: Twitter API OAuth Questions - (401) Unauthorized error when posting status
Hello, It looks like your base string is formatted correctly to generate the signature. Not sure if you displayed the final URL for clarity, but since sending a status update requires a POST, you need to put all of the parameters in the body of the POST request instead of in the URL query string. Thanks, -Chad On Thu, Sep 24, 2009 at 10:16 AM, eclipsed4utoo wrote: > > So after battling OAuth, I finally was able to get an access token. > But now, I am getting a 401 Unauthorized error when trying to post the > status. > > My question is, what parameters do I need to send for posting a > status? All parameters(consumer key, consumer secret, token, token > secret, nonce, timestamp, signature method, version)? Does that > status go as a parameter, or is it written to the request like done > with Basic Authentication? If it goes as a parameter, does it go as a > parameter that is part of the signature, or is it tacked on at the end > after the signature? I am doing a desktop app, so I have the PIN. > Does the PIN need to also be a parameter to update the status? > > With this generic message, it's hard for me to figure out what I am > doing wrong. I don't know if I am missing parameters, have too many > parameters, or something that has nothing to do with the parameters. > I am using .Net, which is throwing an exception when trying to get the > response. All I can see is "(401) Unauthorized". > > I tried going by the OAuth core documentation for accessing protected > resources: > > http://oauth.net/core/1.0#anchor13 > > but still get the same error. > > Here is my POST data for updating a status: > > POST&http%3A%2F%2Ftwitter.com%2Fstatuses > %2Fupdate.xml&oauth_consumer_key%3Dr1asAzyH1Kyq4BWE8ZlEg%26oauth_nonce > %3D773772%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp > %3D1253801265%26oauth_token%3D65084988- > fQr5UVeZ6TDLZ9DQp7hEkOT0lXtAUUNp3AbYnCX8F%26oauth_version > %3D1.0%26status%3DHelloWorld > > and my final URL looks like... > > http://twitter.com/statuses/update.xml?oauth_consumer_key=r1asAzyH1Kyq4BWE8ZlEg&oauth_nonce=773772&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1253801265&oauth_token=65084988-fQr5UVeZ6TDLZ9DQp7hEkOT0lXtAUUNp3AbYnCX8F&oauth_version=1.0&status=HelloWorld&oauth_signature=5hYORksKDi%2bxF2LqXCxWrTI1ozk%3d >