0

I've been trying to create a session, even with curl it's giving me something weird (I wiped app id and auth key out in this post):

curl -X POST \
-H "Content-Type: application/json" \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-d '{"application_id": "XXX", "auth_key": "XXXXXXXXXXXXXX", "timestamp": $(date -j -f "%a %b %d %T %Z %Y" "`date`" "+%s"), "nonce": "1236221330", "signature": "b51f77e6a233db78a3785e3cf8b27aa4e151bd96"}' \
https://api.quickblox.com/session.json

With this I'm getting back this HTML body:

<body>
  <!-- This file lives in public/500.html -->
  <div class="dialog">
    <h1>We're sorry, but something went wrong.</h1>
    <p>We've been notified about this issue and we'll take a look at it shortly.</p>
  </div>
</body>

The example is pretty much straight from the doc, except the time stamp part. The signature has Anything I'm doing wrong?

huggie
  • 17,587
  • 27
  • 82
  • 139

2 Answers2

2

Try this params format

-d "application_id=140&auth_key=7quWEh-k6TqghXe&timestamp=1326964049&nonce=414546828&signature=e6e603c251a569e70a2f27a8c71b5017e81e05d5" 

not json body

Rubycon
  • 18,156
  • 10
  • 49
  • 70
  • I tried it, but I'm still getting the same response. Maybe anything wrong with the prior step? Prior to this I called https://api.quickblox.com/auth.json and get the token. That's all I did before trying to create the session. – huggie Aug 01 '13 at 08:40
0

This CURL example works OK

curl -X POST -H "Content-Type: application/json" -H "QuickBlox-REST-API-Version: 0.1.0" 
-d '{"application_id":"1","auth_key":"gHT98dDU2zpkKej","nonce":"33432","timestamp":"1375384935","signature":"242f6407b4cd6f0b06d1bca67faac4b57eb21c26"}' http://api.quickblox.com/session.json

just type it in terminal

Rubycon
  • 18,156
  • 10
  • 49
  • 70
  • Thanks, the error went away(I guess it was the way I get timestamp that's interfering with it). But now it says "{"errors":{"base":["Unexpected signature"]}}". The same signature was sent to "https://api.quickblox.com/auth.json" and got a token in return. So isn't it valid? – huggie Aug 02 '13 at 02:18
  • You have to use valid timestamp, not older than 20 mins – Rubycon Aug 02 '13 at 05:59
  • I did just grab a recent timestamp though, just a few seconds before the command. – huggie Aug 02 '13 at 06:24
  • Ok, Unexpected signature means that you have problem with signature generation, please check how you do this – Rubycon Aug 02 '13 at 08:40
  • I haven't figure it out if anything was wrong with that process. I'll ask a separate question then since the response is now different. – huggie Aug 04 '13 at 11:35