0

使用 Kinvey 是否有一种方法可以自动生成用户(如本文档中:http ://devcenter.kinvey.com/ios/guides/users#autogenerated )但对于 REST 或 AngularJS?

4

1 回答 1

1

自动生成用户基本上是使用电子邮件进行注册,最终创建一个随机的用户名和密码。

可以使用任何 Kinvey SDK 以及 REST:

  1. AngularJS

    var promise = $kinvey.User.signup({
      email : '<user-email>'
    });
    promise.then(function(user) {
      alert('Kinvey User signup Success.');
    }, function(err) {
      alert('Kinvey User signup Failed.');
    });
    
  2. 休息

POST /user/:appKey/ HTTP/1.1
Host: baas.kinvey.com
Authorization: [Basic Auth with app credentials]
Content-Type: application/json
{"email" : "<user-email>"}

如果您不在 Kinvey 应用程序的用户设置中强制执行电子邮件验证,则用户电子邮件是可选的。

在这种情况下,您可以使用空主体(即 {})执行 POST 请求。

参考:

  1. http://devcenter.kinvey.com/angular/guides/users#signup
  2. http://devcenter.kinvey.com/rest/guides/users#signup
于 2016-02-03T11:40:33.237 回答