I’m trying to create a custom authenticator to sync gateway for the iOS version of my app but I don’t see any documentation on how to do so. I already have code setup on the web server to create the syncgateway session and I have been using a custom authorizer in the Android version of the app, just trying to get the iOS version of the app on board.
Hi @kanundrum,
Are you using the createBasicAuthenticator
method in the Android SDK?
Is the app server creating sessions for users?
Not sure what you mean by custom authorizer.
James
PS: It looks like you figured out the app server part but this tutorial might help anyways.
I already have it working in Android (I created a custom authorizer in Android using the provided “Authorizer” class. This uses the google sign in token to authenticate). I’m trying to do the same for iOS
Sorry I’m a bit confused as to how Sync Gateway will handle the Google Sign In token.
Does this custom authorizer retrieve a cookie session from your web server and then passes it to the Replicator in the Android SDK.
Can you share the code for the custom authenticator in a gist?
iOS doesn’t support custom authenticators yet, but that’s actually a feature I’m about to start working on. It would be useful for me to see what you’re doing with it on the Java side. I assume you’ve got an app server in place, and the mobile app needs to POST credentials to your server, which then has SG generate a session cookie for the client to use?
You can see the basic code I have in java in the gist - Example of using a Custom Authorizer with Couchbase Lite in Java · GitHub
@jens The java side of things was straight forward. The server side a bit more work (basically what you said with the added step of setting up a reverse proxy to make the calls all come from the same domain) . A bit disappointed that it’s not as easy in iOS as it is in Android (yet), are there any options I can consider in the mean time (short of using the existing available options, and swift examples would be doubly helpful)?