Skip to content

Instantly share code, notes, and snippets.

@schappim
Created August 10, 2012 04:34
Show Gist options
  • Save schappim/3311100 to your computer and use it in GitHub Desktop.
Save schappim/3311100 to your computer and use it in GitHub Desktop.
Ninja Blocks Authentication Example
$ curl -H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{"email":"[email protected]","password":"correctpassword"}' \
-i https://a.ninja.is/signin | json
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Date: Thu, 02 Aug 2012 01:05:59 GMT
X-Powered-By: Express
Content-Length: 124
Connection: keep-alive
{
"result": 1,
"error": null,
"id": 0,
"data": {
"ninja.sid": "DYjuqrmbE6LBqAIS86bk373X.7ygX0lzun8Nk6XCZTRs373NQ7qRbD2MngInekHiqYho"
}
}
$ curl -H 'Cookie: ninja.sid=DYjuqrmbE6LBqAIS86bk373X.7ygX0lzun8Nk6XCZTRs373NQ7qRbD2MngInekHiqYho' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-i https://a.ninja.is/rest/v0/user/pusherchannel | json
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Date: Thu, 02 Aug 2012 01:23:16 GMT
Set-Cookie: ninja.sid=DYjuqrmbD6LBqAIS86bk373X.7ygX0lzun8Nj6XCZTRs373NQ7qQbD2MngInekGiqYho; domain=.ninja.is; path=/; expires=Thu, 02 Aug 2012 03:23:10 GMT; httpOnly; secure
Strict-Transport-Security: max-age=31536000; includeSubdomains
X-Powered-By: Express
Content-Length: 2
Connection: keep-alive
{
"result": 1,
"error": null,
"id": 0,
"data": {
"pusherChannel": "1c0c8929-3318-411d-96e0-36fb7872ea5e"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment