[twitter-dev] Twitter API OAuth Questions - (401) Unauthorized error when posting status
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
[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] Issue with API?
Does anybody know if there is an issue with the friends_timeline REST method? When I do it, it returns tweets from all of my friends. However, the "following" XML tag is false. How can that be? They are my friend if I am following them, correct? http://twitter.com/statuses/friends_timeline.xml and this is the first status that is returned. Sat Oct 10 14:36:56 + 2009 4761273314 Disk2vhd Turns Your PC Into a Virtual Machine: http://bit.ly/1z6lNa http://www.tweetdeck.com/"; rel="nofollow">TweetDeck false false 43065412 George Dan Pirvu gamearchitect a giant cubicle Programming games since 1997. Psychologist, internet marketer, horrible chess player. http://a3.twimg.com/profile_images/280718799/georgep_normal.jpg http://www.randombyte.com false 7643 9AE4E8 33 0084B4 DDFFCC BDDCAD 8148 Thu May 28 07:08:07 + 2009 0 7200 Bucharest http://a3.twimg.com/profile_background_images/19709051/olivemanna_islandpalms.jpg true 656 false false false false So how can that be?
[twitter-dev] Screen Scraping against TOS?
I was just wondering if screen scraping for OAuth for a desktop application was against the TOS? I tried reading it, but couldn't find anything. By screen scraping, I mean to send requests to twitter, and scrape the PIN from the page, and then use it for authorization. Ryan
[twitter-dev] Re: HTTP Server Error 503 No available server to handle this request
Are people still having issues posting status updates from third party applications? I haven't been able to post all day. Still can't post now. There isn't an update on the Twitter status page. I didn't know if that was because it wasn't fixed yet, or because they just haven't updated it post yet. Ryan On Oct 12, 4:56 pm, Andrew Badera wrote: > On Mon, Oct 12, 2009 at 4:42 PM, John Kalucki wrote: > > > We need to get better at > > the status blog, but it's rare that we aren't responding to a site- > > wide issue within moments. > > > -John Kalucki > >http://twitter.com/jkalucki > > Services, Twitter Inc. > > Any idea when that might happen? I've been seeing this issue for over > four hours now. Had a 4pm EDT client phone call, and didn't have much > to tell them. I understand there's a lot going on that you guys need > to handle, but the entire ecosystem that helped popularize Twitter has > a financial motivation that needs to be attended to, even if Twitter's > current momentum has carried it past us little people. And Twitter has > shown a history of going to the media before informing us folk. There > needs to be a better balance. > > ∞ Andy Badera > ∞ +1 518-641-1280 > ∞ This email is: [ ] bloggable [x] ask first [ ] private > ∞ Google me:http://www.google.com/search?q=andrew%20badera
[twitter-dev] (411) Length Required error
Ok, this is really starting to screw with me. On Sunday, I received this error. I put in code to send the content length when making a status update. It worked on Sunday. On Monday, the POST request started hanging. For two days, I tried to figure out what the problem was. So last night, I removed the code to add the content length. IT WORKED!!! Now, this morning, I am getting the error again that the length is required. So which is it? Is the length required or not? Last night it was not required, this morning it is. If I send it and it's not required, it hangs the request indefinitely. If I don't send it and it's required, I get an error message. Any help?
[twitter-dev] Re: (411) Length Required error
Here is a screenshot right before make the request. http://yfrog.com/8d10142009115958amp You can see that there is only the "Content-Type" header. But you can also see that the ContentLength is set(to 6...length of my status update). .Net doesn't allow me to add the header manually if the object has a property for that header. Ryan On Oct 14, 12:05 pm, ryan alford wrote: > Another question is, what has changed? This code has been working fine > since September 24th(sending the ContentLength). Then on October 11th, I > start having issues. > Ryan > > On Wed, Oct 14, 2009 at 11:58 AM, ryan alford wrote: > > > > > Other code uses this snippet also. > > Now this is even more hilarious. I am testing right now. I am sending the > > ContentLength no matter what. > > > I now can't post status updates again. If I give it the ContentLength, it > > just hangs. If I don't give it the ContentLength, I get the error. > > > If I give it the ContentLength, I can send Direct Messages(length = 0). If > > I don't give it the ContentLength, I get the same error with direct > > messages. > > > When I view the request header, the only header there is the > > "Content-Type". > > > Ryan > > > On Wed, Oct 14, 2009 at 11:26 AM, Chad Etzel wrote: > > >> On Wed, Oct 14, 2009 at 11:17 AM, ryan alford > >> wrote: > >> > Here is the code... > >> >http://pastebin.com/m7ea04ea2 > >> > Last night, that code worked(with the content length being commented > >> out). > >> > This morning, it gives me the "length required" error. > >> > Ryan > > >> I am not extremely familiar with C#, but you might want to run a trace > >> to see what exactly the HTTP request headers are that you are sending. > >> Are you calling this code only for posting an update? Or are there > >> other methods using this code as well? I know for requests like > >> friendship/create you have to set the content-length to 0 for the > >> request to work if you specify the username in the URL... > > >> -Chad > > >> > On Wed, Oct 14, 2009 at 11:09 AM, Chad Etzel wrote: > > >> >> Can you post your code snippet (in something like pastie or pastebin)? > >> >> Content-length should almost always be required for POSTs (from HTTP > >> >> spec). > > >> >> -Chad > > >> >> On Wed, Oct 14, 2009 at 8:56 AM, eclipsed4utoo < > >> ryanalford...@gmail.com> > >> >> wrote: > > >> >> > Ok, this is really starting to screw with me. On Sunday, I received > >> >> > this error. I put in code to send the content length when making a > >> >> > status update. It worked on Sunday. On Monday, the POST request > >> >> > started hanging. For two days, I tried to figure out what the > >> problem > >> >> > was. So last night, I removed the code to add the content length. > >> IT > >> >> > WORKED!!! > > >> >> > Now, this morning, I am getting the error again that the length is > >> >> > required. > > >> >> > So which is it? Is the length required or not? Last night it was > >> not > >> >> > required, this morning it is. If I send it and it's not required, it > >> >> > hangs the request indefinitely. If I don't send it and it's > >> required, > >> >> > I get an error message. > > >> >> > Any help?
[twitter-dev] Re: (411) Length Required error
So any thoughts/ideas? Ryan On Oct 14, 12:09 pm, eclipsed4utoo wrote: > Here is a screenshot right before make the request. > > http://yfrog.com/8d10142009115958amp > > You can see that there is only the "Content-Type" header. But you can > also see that the ContentLength is set(to 6...length of my status > update). > > .Net doesn't allow me to add the header manually if the object has a > property for that header. > > Ryan > > On Oct 14, 12:05 pm, ryan alford wrote: > > > > > Another question is, what has changed? This code has been working fine > > since September 24th(sending the ContentLength). Then on October 11th, I > > start having issues. > > Ryan > > > On Wed, Oct 14, 2009 at 11:58 AM, ryan alford > > wrote: > > > > Other code uses this snippet also. > > > Now this is even more hilarious. I am testing right now. I am sending > > > the > > > ContentLength no matter what. > > > > I now can't post status updates again. If I give it the ContentLength, it > > > just hangs. If I don't give it the ContentLength, I get the error. > > > > If I give it the ContentLength, I can send Direct Messages(length = 0). > > > If > > > I don't give it the ContentLength, I get the same error with direct > > > messages. > > > > When I view the request header, the only header there is the > > > "Content-Type". > > > > Ryan > > > > On Wed, Oct 14, 2009 at 11:26 AM, Chad Etzel wrote: > > > >> On Wed, Oct 14, 2009 at 11:17 AM, ryan alford > > >> wrote: > > >> > Here is the code... > > >> >http://pastebin.com/m7ea04ea2 > > >> > Last night, that code worked(with the content length being commented > > >> out). > > >> > This morning, it gives me the "length required" error. > > >> > Ryan > > > >> I am not extremely familiar with C#, but you might want to run a trace > > >> to see what exactly the HTTP request headers are that you are sending. > > >> Are you calling this code only for posting an update? Or are there > > >> other methods using this code as well? I know for requests like > > >> friendship/create you have to set the content-length to 0 for the > > >> request to work if you specify the username in the URL... > > > >> -Chad > > > >> > On Wed, Oct 14, 2009 at 11:09 AM, Chad Etzel wrote: > > > >> >> Can you post your code snippet (in something like pastie or pastebin)? > > >> >> Content-length should almost always be required for POSTs (from HTTP > > >> >> spec). > > > >> >> -Chad > > > >> >> On Wed, Oct 14, 2009 at 8:56 AM, eclipsed4utoo < > > >> ryanalford...@gmail.com> > > >> >> wrote: > > > >> >> > Ok, this is really starting to screw with me. On Sunday, I received > > >> >> > this error. I put in code to send the content length when making a > > >> >> > status update. It worked on Sunday. On Monday, the POST request > > >> >> > started hanging. For two days, I tried to figure out what the > > >> problem > > >> >> > was. So last night, I removed the code to add the content length. > > >> IT > > >> >> > WORKED!!! > > > >> >> > Now, this morning, I am getting the error again that the length is > > >> >> > required. > > > >> >> > So which is it? Is the length required or not? Last night it was > > >> not > > >> >> > required, this morning it is. If I send it and it's not required, > > >> >> > it > > >> >> > hangs the request indefinitely. If I don't send it and it's > > >> required, > > >> >> > I get an error message. > > > >> >> > Any help?
[twitter-dev] Re: (411) Length Required error
Ok. nevermind. I have it fixed now. Since I am using OAuth, I am not writing a stream to the request object (like I would do with Basic Auth). So I changed the ContentLength to 0, and it works. Could the response had been waiting for me to stream the content to it since I told it the length? I guess that could have cause the indefinite hanging. Ryan On Oct 14, 6:59 pm, eclipsed4utoo wrote: > So any thoughts/ideas? > > Ryan > > On Oct 14, 12:09 pm, eclipsed4utoo wrote: > > > > > Here is a screenshot right before make the request. > > >http://yfrog.com/8d10142009115958amp > > > You can see that there is only the "Content-Type" header. But you can > > also see that the ContentLength is set(to 6...length of my status > > update). > > > .Net doesn't allow me to add the header manually if the object has a > > property for that header. > > > Ryan > > > On Oct 14, 12:05 pm, ryan alford wrote: > > > > Another question is, what has changed? This code has been working fine > > > since September 24th(sending the ContentLength). Then on October 11th, I > > > start having issues. > > > Ryan > > > > On Wed, Oct 14, 2009 at 11:58 AM, ryan alford > > > wrote: > > > > > Other code uses this snippet also. > > > > Now this is even more hilarious. I am testing right now. I am sending > > > > the > > > > ContentLength no matter what. > > > > > I now can't post status updates again. If I give it the ContentLength, > > > > it > > > > just hangs. If I don't give it the ContentLength, I get the error. > > > > > If I give it the ContentLength, I can send Direct Messages(length = 0). > > > > If > > > > I don't give it the ContentLength, I get the same error with direct > > > > messages. > > > > > When I view the request header, the only header there is the > > > > "Content-Type". > > > > > Ryan > > > > > On Wed, Oct 14, 2009 at 11:26 AM, Chad Etzel wrote: > > > > >> On Wed, Oct 14, 2009 at 11:17 AM, ryan alford > > > >> wrote: > > > >> > Here is the code... > > > >> >http://pastebin.com/m7ea04ea2 > > > >> > Last night, that code worked(with the content length being commented > > > >> out). > > > >> > This morning, it gives me the "length required" error. > > > >> > Ryan > > > > >> I am not extremely familiar with C#, but you might want to run a trace > > > >> to see what exactly the HTTP request headers are that you are sending. > > > >> Are you calling this code only for posting an update? Or are there > > > >> other methods using this code as well? I know for requests like > > > >> friendship/create you have to set the content-length to 0 for the > > > >> request to work if you specify the username in the URL... > > > > >> -Chad > > > > >> > On Wed, Oct 14, 2009 at 11:09 AM, Chad Etzel > > > >> > wrote: > > > > >> >> Can you post your code snippet (in something like pastie or > > > >> >> pastebin)? > > > >> >> Content-length should almost always be required for POSTs (from HTTP > > > >> >> spec). > > > > >> >> -Chad > > > > >> >> On Wed, Oct 14, 2009 at 8:56 AM, eclipsed4utoo < > > > >> ryanalford...@gmail.com> > > > >> >> wrote: > > > > >> >> > Ok, this is really starting to screw with me. On Sunday, I > > > >> >> > received > > > >> >> > this error. I put in code to send the content length when making > > > >> >> > a > > > >> >> > status update. It worked on Sunday. On Monday, the POST request > > > >> >> > started hanging. For two days, I tried to figure out what the > > > >> problem > > > >> >> > was. So last night, I removed the code to add the content length. > > > >> IT > > > >> >> > WORKED!!! > > > > >> >> > Now, this morning, I am getting the error again that the length is > > > >> >> > required. > > > > >> >> > So which is it? Is the length required or not? Last night it was > > > >> not > > > >> >> > required, this morning it is. If I send it and it's not > > > >> >> > required, it > > > >> >> > hangs the request indefinitely. If I don't send it and it's > > > >> required, > > > >> >> > I get an error message. > > > > >> >> > Any help?
[twitter-dev] OAuth - "Username or Password is incorrect"?
Starting about 20 minutes ago, I started getting this error message with my application. I am strictly using OAuth, so how exactly would the username or password be incorrect? I haven't changed the code in weeks. Anybody else having this problem?
[twitter-dev] Re: OAuth - "Username or Password is incorrect"?
This would be a 401 "unauthorized" error. I also can't seem to do the OAuth authorization again.
[twitter-dev] 401 - Unauthorized error when diacritics in status
I am getting an error message when posting accent marks and other diacritics in a status update. I saw that there was an issue [1] posted in April of last year about this problem. It seems to be with the signature generation for OAuth with the encoding of accent marks. I am using .Net(C#), and I can't figure out how to fix this. Do I use a different encoding? Anybody have any ideas on how to fix this in .Net? [1] - http://code.google.com/p/twitter-api/issues/detail?id=433 Ryan
[twitter-dev] OAuth Rate Limit Increase - Not seeing it
I thought that the OAuth Rate Limit went up to 350? I am still getting 150. Here is the returned XML from my request to http://api.twitter.com/1/account/rate_limit_status.xml 2010-03-02T19:42:28+00:00 150 1267558948 150 I am using OAuth and using the new "version" of the REST API. What else do I need to do?