Re: [twitter-dev] Signature generation issue
After fixing the basic parts of your signature (please don't ever replace %26 with only a %, it screws up the encoding) and checking at http://quonos.nl/oauthTester/, I got : *Bad sorting!* All Base String parameters (query and POST parameters) must be sorted alphabetically. Tom On 3/14/11 3:02 PM, lappynet wrote: Hi I'm using C#.NET to produce an oob client. I've fallen at the first hurdle though as I'm failing to make the token request. I've gone through many iterations, and am no longer receiving a 417, 404, or 401. This is very positive! Now my application hangs whilst waiting for a response from twitter. (I left it running for an hour over lunch and still nothing happened, and the code didn't appear to want to step through.) I've tried with the values detailed in the documentation to have a look at the variables that have been produced from them in my algorithm. I think that I've traced it down to being the way I generate the signature string: string signingKey = Uri.EscapeDataString(ConsumerSecret) + ; HMACSHA1 hasher = new HMACSHA1(new ASCIIEncoding().GetBytes(signingKey)); string signatureString = Convert.ToBase64String(hasher.ComputeHash(new ASCIIEncoding().GetBytes(baseString))); My base string is: POSThttps%3A%2F%2Fapi.twitter.com%2Foauth %2Frequest_tokenoauth_callback%3Doob%26oauth_consumer_key%XXX %26oauth_nonce%3DNjM0MzU3MDgxMDEyMDcwODkw%26oauth_signature_method %3DHMAC-SHA1%26oauth_timestamp%3D1300111301%26oauth_version%3D1.0 Any pointers as to where I may be going wrong? Thanks in advance Georgina -- 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
Re: [twitter-dev] Signature generation issue
Hi Georgina, Everything appears correct with your base string for this step. Are you performing this operation through a HTTP proxy of any kind? Have you tried producing a valid OAuth header and executed it in curl (without having executed it in C# first)? I'm not familiar with C#'s HTTP request libraries and the configuration options available to you in it. We were having an issue with occasionally hanging connections recently and it's possible that it may be related -- but if that's the case, you shouldn't have it occur to you every time -- it would be one out of X times. I'm curious where the connection is hanging -- while you are sending HTTP request headers or when your HTTP client is awaiting a response? Thanks, Taylor On Mon, Mar 14, 2011 at 7:02 AM, lappynet georgina.hug...@gmail.com wrote: Hi I'm using C#.NET to produce an oob client. I've fallen at the first hurdle though as I'm failing to make the token request. I've gone through many iterations, and am no longer receiving a 417, 404, or 401. This is very positive! Now my application hangs whilst waiting for a response from twitter. (I left it running for an hour over lunch and still nothing happened, and the code didn't appear to want to step through.) I've tried with the values detailed in the documentation to have a look at the variables that have been produced from them in my algorithm. I think that I've traced it down to being the way I generate the signature string: string signingKey = Uri.EscapeDataString(ConsumerSecret) + ; HMACSHA1 hasher = new HMACSHA1(new ASCIIEncoding().GetBytes(signingKey)); string signatureString = Convert.ToBase64String(hasher.ComputeHash(new ASCIIEncoding().GetBytes(baseString))); My base string is: POSThttps%3A%2F%2Fapi.twitter.com%2Foauth %2Frequest_tokenoauth_callback%3Doob%26oauth_consumer_key%XXX %26oauth_nonce%3DNjM0MzU3MDgxMDEyMDcwODkw%26oauth_signature_method %3DHMAC-SHA1%26oauth_timestamp%3D1300111301%26oauth_version%3D1.0 Any pointers as to where I may be going wrong? Thanks in advance Georgina -- 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
Re: [twitter-dev] Signature generation issue
Wow, my blindness to signature base string foo this morning is humbling. Thanks Tom. On Mon, Mar 14, 2011 at 7:15 AM, Tom van der Woerdt i...@tvdw.eu wrote: After fixing the basic parts of your signature (please don't ever replace %26 with only a %, it screws up the encoding) and checking at http://quonos.nl/oauthTester/, I got : *Bad sorting!* All Base String parameters (query and POST parameters) must be sorted alphabetically. Tom On 3/14/11 3:02 PM, lappynet wrote: Hi I'm using C#.NET to produce an oob client. I've fallen at the first hurdle though as I'm failing to make the token request. I've gone through many iterations, and am no longer receiving a 417, 404, or 401. This is very positive! Now my application hangs whilst waiting for a response from twitter. (I left it running for an hour over lunch and still nothing happened, and the code didn't appear to want to step through.) I've tried with the values detailed in the documentation to have a look at the variables that have been produced from them in my algorithm. I think that I've traced it down to being the way I generate the signature string: string signingKey = Uri.EscapeDataString(ConsumerSecret) + ; HMACSHA1 hasher = new HMACSHA1(new ASCIIEncoding().GetBytes(signingKey)); string signatureString = Convert.ToBase64String(hasher.ComputeHash(new ASCIIEncoding().GetBytes(baseString))); My base string is: POSThttps%3A%2F%2Fapi.twitter.com%2Foauth %2Frequest_tokenoauth_callback%3Doob%26oauth_consumer_key%XXX %26oauth_nonce%3DNjM0MzU3MDgxMDEyMDcwODkw%26oauth_signature_method %3DHMAC-SHA1%26oauth_timestamp%3D1300111301%26oauth_version%3D1.0 Any pointers as to where I may be going wrong? Thanks in advance Georgina -- 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
Re: [twitter-dev] Signature generation issue
No, actually, it was my fault: it wasn't a %26, but a %3D. Oops! Base string is fine. Tom On 3/14/11 3:21 PM, Taylor Singletary wrote: Wow, my blindness to signature base string foo this morning is humbling. Thanks Tom. On Mon, Mar 14, 2011 at 7:15 AM, Tom van der Woerdt i...@tvdw.eu mailto:i...@tvdw.eu wrote: After fixing the basic parts of your signature (please don't ever replace %26 with only a %, it screws up the encoding) and checking at http://quonos.nl/oauthTester/, I got : *Bad sorting!* All Base String parameters (query and POST parameters) must be sorted alphabetically. Tom On 3/14/11 3:02 PM, lappynet wrote: Hi I'm using C#.NET to produce an oob client. I've fallen at the first hurdle though as I'm failing to make the token request. I've gone through many iterations, and am no longer receiving a 417, 404, or 401. This is very positive! Now my application hangs whilst waiting for a response from twitter. (I left it running for an hour over lunch and still nothing happened, and the code didn't appear to want to step through.) I've tried with the values detailed in the documentation to have a look at the variables that have been produced from them in my algorithm. I think that I've traced it down to being the way I generate the signature string: string signingKey = Uri.EscapeDataString(ConsumerSecret) + ; HMACSHA1 hasher = new HMACSHA1(new ASCIIEncoding().GetBytes(signingKey)); string signatureString = Convert.ToBase64String(hasher.ComputeHash(new ASCIIEncoding().GetBytes(baseString))); My base string is: POSThttps%3A%2F%2Fapi.twitter.com http://2Fapi.twitter.com%2Foauth %2Frequest_tokenoauth_callback%3Doob%26oauth_consumer_key%XXX %26oauth_nonce%3DNjM0MzU3MDgxMDEyMDcwODkw%26oauth_signature_method %3DHMAC-SHA1%26oauth_timestamp%3D1300111301%26oauth_version%3D1.0 Any pointers as to where I may be going wrong? Thanks in advance Georgina -- 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 -- 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