I'm using Facebook Login with Couchbase Lite, attempting to do the same set 
up as TodoLite-iOS (https://github.com/couchbaselabs/ToDoLite-iOS)
When a user logs in, open a new db (with its name being an md5 hash of the 
user's email).
Set up push/pull replications with authenticator property like so (token is 
returned from facebook sdk):

pull.authenticator = CBLAuthenticator.facebookAuthenticatorWithToken(token)

When logging out and logging back in with a different account, sync gateway 
runs the previous replication, thus pulling the data of another user) 
instead of running the replication with the new user's token. Is there a 
way to force a replication to be invalidated?
Side question: can couchbase lite run several replications with different 
authenticators?
In my case logging in or out is irrelevant. It will always run the 
replication that was setup when the app was first opened and never run the 
replication of the next user logging in on the device.

Setup replication (upon login):
let syncURL = NSURL(string: kSyncGatewayUrl)
pull = currentDatabase.createPullReplication(syncURL) // currentDatabase is 
the user's db (name: md5 of user's email)
pull.continuous = true

push = currentDatabase.createPushReplication(syncURL)
push.continuous = true

Stop replication (when logging out):
pull.stop()
pull = nil

push.stop()
push = nil

-- 
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/b72e351a-28c3-432a-9a79-6d792fcff52a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to