The way I do it is to use basic auth on the url like so: var url = REMOTE_SYNC_PROTOCOL + encodeURIComponent( window.config.user.name ) + ":" + encodeURIComponent( window.config.user.password ) + "@" + REMOTE_SYNC_SERVER + ":" + REMOTE_SYNC_PORT + "/"; You still have to create the session in the sync gateway first though.
On Tuesday, 16 December 2014 15:14:27 UTC-8, Federico Hernandez wrote: > > Hi everybody, > > I've used the phonegap plugin to create a mobile app. > > Now, I'm trying to to perform a custom authentication to the Sync Manager. > To do so, I've added a user into the Sync Manager and then created a > session. I copied the session_id and cookie_name to create the cookie in > the mobile app. However, when the app tries to connect to the Sync Manager, > the app gets a 401 Login Required. If I do the same using the GUEST user, I > can push and retrieve documents from the Sync Manager. > > Does anybody have a good example of how to do a Custom Authentication? If > not, can anybody point me in the right direction? > > Thanks in advance, > -- 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/5183b31b-f55f-48b4-9334-568ec853e943%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
