Thank you very much. I can get/modify docs by SyncGatewaySession now.

On Saturday, June 27, 2015 at 10:14:05 PM UTC+8, ajres wrote:
>
> @atom992
>
> I just ran the following against a clean Sync Gateway (master) DB with a 
> user defined in config.json
>
> ```
>
> "user1": {"disabled": false, "password":"passw0rd", "admin_channels": 
> ["*"]}
> ```
>
> Write a doc with basic auth
> ```
>
> $ curl -X PUT  http://user1:passw0rd@localhost:4984/db/doc1 -d '{ 
> "foo":"bar"}' -H 'Content-Type: application/json'
>
> ```
>
> Create a users session via the ADMIN REST API
>
> ```
>
> $ curl -X POST http://localhost:4985/db/_session -d '{ 
> "name":"user1","password":"passw0rd"}' -H "Content-Type: application/json"
>
> ```
>
> Response: 
> {"session_id":"971106d126515e4e071ad05070ffc76627289c16","expires":"2015-06-28T14:51:10.961084691+01:00","cookie_name":"SyncGatewaySession"}
>
>
> ```
>
> $ curl --cookie 
> "SyncGatewaySession=971106d126515e4e071ad05070ffc76627289c16" -X GET 
> http://localhost:4984/db/doc1
>
> ```
>
>
> Response: 
> {"_id":"doc1","_rev":"1-cd809becc169215072fd567eebd8b8de","foo":"bar"}
>
>
> You can check that a valid session document exists in the DB, for your 
> example the doc name will be:
>
>
> _sync:session:2823i1826e9e2ad72af0409e0703f9bf1s9317d3
>
>
> Check the expiration property to make sure the cookie is still active.
>
>
> Andy
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/mobile-couchbase/8a5182da-c48b-4299-ba05-b7b11831534a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to