How to use admin REST API in xamarin application to create new users?

I am creating a xamarin mobile application and I want to create new users from the mobile application , I know I can create users from sync gateway configuration or from admin REST API ,
I tried to use the admin REST API in the application but I got Java.Net.SocketTimeoutException

so how can I use the admin REST API to create users in the application ?

Can you confirm that the POST {db}/_user/ call works from curl or Postman?
The exception indicates that the app cannot connect to Sync Gateway so the call is timing out.

Cross-posting from StackOverflow: https://stackoverflow.com/a/59577429/1278537

In Sync Gateway, port 4985 is intentionally not public by default. Opening it allows anybody full access to your data.

  1. Integrate with a third-party authentication provider using OpenID Connect. You can configure these to create users on-demand when they sign in. https://docs.couchbase.com/sync-gateway/current/authentication.html#openid-connect

  2. Write your own small service that can take new user requests from your app, which then calls out to a firewalled Sync Gateway Admin API. https://docs.couchbase.com/sync-gateway/current/authentication.html#custom-authentication

“create service that can take new user requests from your app” => can you please more explain this part , Thanks . – Maria Nabil Jan 5 at 14:51

You’ll have to write your own API that can take public new user requests that your app can call.

This should be running somewhere that can talk to the Admin API port without exposing it publically. For example, the same host and use localhost:4985, or a firewall rule to allow your service admin access.