Hi.
I am trying to get user profiles up running. I have that sync-func on my
sync_gateway server:
if (doc.type == "profile") {
var user = doc.owner;
requireUser(user);
log("Access user:" + doc.owner + " to channel:" + "profile-" + doc.owner);
access(doc.owner, "profile-" + doc.owner);
channel("profile-" + doc.owner);
}
As I am using oauth2 against an existing backent I choosed to use a node.js
server to verify email/pwd and then create/update that user over
sync_gateway port 4985 and after that a session. With that session I create
a profile document on port 4984. I return the sync_gateway create session
response to the app.
In the app I create a pull/push and start replication with:
self.pull.setCookieNamed(cookie_name, withValue: session_id, path: nil,
expirationDate:date, secure: false)
self.pull.continuous = true
self.pull.start()
Now my problem/misunderstanding?
If I want to login as a different User, I stop the current replication,
login with the new credentials, get a new session and recreate the
replications with the new sessions. My problem then: the profile document
of the new user is not pulled/synced.
When I set the continuous to false I gat a different behaviour. The first
sync does not fetch the profile document. After starting the sync again, it
is fetched. Logging in as a different user now does fetch the new profile
document and I end up with two profile documents in my local database
(which is an expected behaviour),
So, to conclude:
What is the "right" way to handle User-specific profile documents in case
of multiple logins/logouts.
Thank you!
--
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/90cca30c-cd87-40c5-877c-68fbcb9c80b0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.