Hi all,
I need some help here, there's something probably simple that I'm not
getting. I got external authentication working, I have the cookie set
correctly and Sync GW recognizes me as a user.
My Sync function looks like this:
function(doc, oldDoc) {
channel("public");
if (doc.email) {
access(doc.email, "public");
}
}
That would mean: tag any doc with "public" channel, and when the document
is a user profile (contains the email field), grant the user called like
the email read access to all documents in the "public"channel. Simple right?
Let's run a simple test with curl. First write a user profile document:
curl -X PUT 'http://sync-gateway:4984/soya_sync/[email protected]' -H
'Pragma: no-cache' -H 'Accept-Encoding: gzip, deflate, sdch' -H
'Accept-Language: en,fi;q=0.8,en-US;q=0.6' -H 'CSP: active' -H
'Content-Type: application/json' -H 'Accept: */*' -H 'Cookie:
SyncGatewaySession=15a0d78914df04947bdeedc6431e747a08eda2f4' -H
'Connection: keep-alive' -d '{"email":"[email protected]"}'
All good, I get the document "[email protected]" created (I can see it in
the UI)
Now let's try to read it:
curl 'http://sync-gateway:4984/soya_sync/[email protected]' -H 'Pragma:
no-cache' -H 'Accept-Encoding: gzip, deflate, sdch' -H 'Accept-Language:
en,fi;q=0.8,en-US;q=0.6' -H 'CSP: active' -H 'Content-Type:
application/json' -H 'Accept: */*' -H 'Cookie:
SyncGatewaySession=15a0d78914df04947bdeedc6431e747a08eda2f4' -H
'Connection: keep-alive'
HTTP 403 {"error":"Forbidden","reason":"forbidden"}
I can't understand why I cannot read it back :(
_Simone
--
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/502fab7a-63c8-4659-ad53-e3c970f3eee5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.