Location: UserService.login

Discussion: Login getting "Bad Response" 400 errorsReported This is a featured thread

Showing 6 posts

sara.n.streeter
Login getting "Bad Response" 400 errors
Jul 12 2008, 4:10 PM EDT | Post edited: Jul 12 2008, 4:10 PM EDT
Hi, I'm writing a Python module based on the PHP example, and so far the URL has been getting all "Bad Response" 400 errors when I try posting it to the sandbox togo.wetpaint.com server. I even tried copying and pasting the URL into the browser and I just got the nondescriptive ERROR message. I'm using hmac sha1 encoding, I tried putting an @ symbol in my email address according to another thread. Nothing seems to work to let me log in. Thanks in advance for your help.

Sara
Do you find this valuable?    
Keyword tags: error login nondescriptive url
devin_wetpaint
devin_wetpaint
1. RE: Login getting "Bad Response" 400 errors
Jul 14 2008, 2:10 AM EDT | Post edited: Jul 14 2008, 2:10 AM EDT
Hi Sara,

Can you PM me the exact URL and parameters you are using for the login call? I'm not sure why you would be seeing a Bad Response error... possibly something in the Python configuration, or the request headers are somehow being corrupted. Try hitting a known URL (e.g: http://www.google.com) via Python to see if the problem is localized to our servers. If it is, then our answer may be in the URL/method/parameters; otherwise we may be troubleshooting the module responsible for establishing the HTTP connection.

If you use Firefox, I recommend the add-on called "Poster" (see https://addons.mozilla.org/en-US/firefox/addon/2691 ). Pasting a URL into a browser will only attempt to perform a GET. Poster will allow you to test not only the GET method, but also POST, PUT, DELETE, and the myriad of other HTTP methods available. It's a great way to test our different API calls.

Hopefully this will get us started in the right direction.

Thanks!

- DC
Do you find this valuable?    

sara.n.streeter
2. RE: Login getting "Bad Response" 400 errors
Jul 14 2008, 9:15 PM EDT | Post edited: Jul 14 2008, 9:15 PM EDT
I'm making some progress - now I'm getting the error <html> <body> Your request could not be processed. Please consult the <a href="http://balco.wetpaint.com">BALCO wiki</a> for support. </body> </html> . I'm still using the sandbox credentials and the URL looks like this: /UserService/login.do?cred.ts=2008-07-14T21:13:35.104000&user.emailOptIn=true&user.email=saranicole1980@gmail.com&cred.sig=d2a3a922499d07e4779d4d9b9907eed867d4416a&user.displayName=Sara&key=507ace0d168024cbcb53a9add0e6fe4e9796012e6b420cfafabac6a4357824ef&user.userId=SARAPY&output=api&ns=sandbox-trial

Weird. I also tried using the POSTER in Firefox and it still gave errors. Oh, also I tried the Google thing and it hit the server - it complained that there was no Content-Length header, but it got to Google.

Thanks,
Sara
Do you find this valuable?    
devin_wetpaint
devin_wetpaint
3. RE: Login getting "Bad Response" 400 errors
Jul 15 2008, 1:10 PM EDT | Post edited: Jul 15 2008, 1:10 PM EDT
Hi Sara,

Ahh... that 500 error is coming back because you are using a formatted timestamp. Try using the raw, numeric timestamp instead for 'cred.ts' and for computing 'cred.sig'. In any case, neither the 500 nor the Bad Response (400) are very helpful. I've logged a bug (WTG-708) for the 500 response.

- DC
Do you find this valuable?    

sara.n.streeter
4. RE: Login getting "Bad Response" 400 errors
Jul 15 2008, 10:22 PM EDT | Post edited: Jul 15 2008, 10:22 PM EDT
Ok - now I'm getting invalid developer key errors - warmer maybe? The URL now looks like this:
cred.ts=1216174879&user.emailOptIn=false&user.email=myemail@gmail.com&cred.sig=84757edea63add1b6e3c6d852dc69ce9218b1b81&user.displayName=Sara&key=507ace0d168024cbcb53a9add0e6fe4e9796012e6b420cfafabac6a4357824ef&user.userId=SARAPY&output=api&ns=sandbox-trial

I fixed the timestamp by converting it to a string so I could concatenate it onto the URL - doubt that would make a difference though.

Sara
Do you find this valuable?    
devin_wetpaint
devin_wetpaint
5. RE: Login getting "Bad Response" 400 errors
Jul 17 2008, 1:56 PM EDT | Post edited: Jul 17 2008, 1:56 PM EDT
Hi Sara,

Alright, this is definitely warmer. I suspect the way you're computing cred.sig is based on the PHP example. After seeing this thread -- http://www.wetpaintinjected.com/thread/1670677/Userservice%2FLogin+errors+with+INVALID_DEVELOPER_KEY -- I noticed that the algorithm in that example is out of date. That's probably where your error is coming from. Try the following:

---cut from http://www.wetpaintinjected.com/page/UserService.login
cred.sig
Developer credential signature. This is calculated as the HMAC-SHA-1 hash of the developer key (the key parameter), the user ID (the user.userId parameter, described below), and the current timestamp (the cred.ts parameter). The key used by the HMAC-SHA-1 algorithm should be the developer secret. For example, in PHP: $sig = hash_hmac( "sha1", $developer_key . $user_id . time(), $developer_secret, FALSE );

Let me know if this makes a difference.

- DC
Do you find this valuable?    

Related Content

  (what's this?Related ContentThanks to keyword tags, links to related pages and threads are added to the bottom of your pages. Up to 15 links are shown, determined by matching tags and by how recently the content was updated; keeping the most current at the top. Share your feedback on Wetpaint Central.)