如何在Xamarin应用程序中使用admin REST API在沙发床同步网关中创建新用户?

问题描述 投票:0回答:1

我正在创建一个xamarin移动应用程序,我想从该移动应用程序创建新用户,我知道我可以通过同步网关配置或admin REST API创建用户,我试图在应用程序中使用admin REST API,但得到了Java.Net.SocketTimeoutException

所以我如何使用admin REST API在应用程序中创建用户?

这里是我正在使用的代码:

        private async void CreateUserBtnClicked(object sender, EventArgs e)
    {
          HttpClient _client = new HttpClient(); //Creating a new instance of HttpClient. (Microsoft.Net.Http)
        content = "{\"Username\":\"user.com\",\"Password\":\"123456\"}";
        string url = "http://<server_ip>:4985/user/";
        var request = await _client.PostAsync(url, new StringContent(content, Encoding.UTF8, "application/json"));
    }
authentication xamarin couchbase couchbase-lite couchbase-sync-gateway
1个回答
0
投票

    使用OpenID Connect与第三方身份验证提供程序集成。您可以将它们配置为在用户登录时按需创建用户。https://docs.couchbase.com/sync-gateway/current/authentication.html#openid-connect
  1. 编写您自己的小型服务,该服务可以从您的应用中接收新的用户请求,然后该应用会调出已防火墙的Sync Gateway Admin API。https://docs.couchbase.com/sync-gateway/current/authentication.html#custom-authentication

© www.soinside.com 2019 - 2024. All rights reserved.