同步用户管理配置文件更新错误

Syncano User Management Profile Update Error

本文关键字:更新 错误 配置文件 管理 用户 同步      更新时间:2023-09-26

我尝试使用Syncano用户管理系统为我的应用程序实现用户注册。我能够使用以下JS库代码成功创建一个新用户:

var sync = new Syncano({ apiKey: 'API_KEY', instance: 'INSTANCE' });
sync.user().add(signUp).then(function(res){
  console.log(res);
}).catch(function(err) {
  console.log(err);
});

然后我尝试通过以下代码向我的用户添加配置文件字段:https://www.syncano.io/user-management-for-your-apps/#adding-fields

var sync = new Syncano({ apiKey: 'API_KEY', instance: 'INSTANCE' });
sync.user().add(signUp).then(function(res){
  var instance = new Syncano({
    apiKey: API_KEY,
    instance: INSTANCE_NAME,
    userKey: res.user_key
  });
  instance.class('user_profile').dataobject(res.id).update({firstName: 'First', lastName: 'Last'});
}).catch(function(err) {
  console.log(err);
});

当我在第一个API的.then()语句中进行第二个API调用时,我得到了这个错误:

" api.syncano.io/v1/实例//类/user_profile/对象/26/实例:1补丁https://api.syncano.io/v1/instances/INSTANCE/classes/user_profile/objects/26/404 (NOT FOUND) user.service.js:77错误:{"detail":" NOT FOUND "}"

任何想法?

看起来示例代码有问题(遗憾的是我写的)。

创建用户后返回的对象中,user对象有id字段,user_profile对象有profile.id字段。

行应该是这样的

instance.class('user_profile').dataobject(res.profile.id).update({firstName: 'First', lastName: 'Last'});

在当前系统中还有另一个警告,我也会注意到-您必须首先将user_profile类的other permissions设置为read

最终将在平台中更改为默认为read

希望这对你有帮助!