Couchbase lite - get document from remote database

#1

My app user creates a profile document which is uploaded using sync gateway and not accessible by guests.
Lets say the user logs out and wants to log in on another device. I obviously do not want to wait for pulling all his document to check if he already made a profile.
I checked the api but couchbase lite does not seem to have methods to check for documents on its connected remote database.
I tried to implement HTTP requests but they fail because the user needs to be authorized to access the document (and he is only authorized over couchbase lite api calls)
Can you help me out?

#2

You could put the profile doc in a channel of its own, and run the first pull using only that channel. Then you’d get the profile quickly without all the other docs. Then you can run a regular pull.

You can send your own requests, but you’ll need to deal with auth. It’s not magic, but the details depend on what platform you’re on and how you’re having CBL authenticate to SG.

#3

yes that could be a way to deal with it.

could you give me some hints on how to send my own requests should i not be happy with the other solution.
i am running cbl on ios and android and authenticating via facebook (and planning on using persona or custom auth later)

#4

You’d need to POST to the URL of the database with /_facebook appended. The body of the request should be a JSON object with a property "access_token" whose value is the same Facebook login token string you used to authenticate the replicator.