我可以使用 Stormpath 访问特定用户的自定义数据吗?

Can I access the custom data of a specific user with Stormpath?

我将 Stormpath 与 Express 一起使用,我想访问数据库中存在的特定用户的自定义数据,但未以该用户身份登录。这将用于管理风格 UI,其中具有特定权限的用户可以编辑其他用户的自定义数据。

如何访问特定用户的数据,就像使用 req.user.customData 访问当前用户的数据一样?

如果您使用的是 express 库,您可以说:

app.get('stormpathApplication').getAccount(account_href_here, function(err, account) {
  if (err) throw err;
  account.getCustomData(function(err, data) {
    if (err) throw err;
    console.log(data);
  });
});

app.get('stormpathApplication') 是引擎盖下的一个应用程序对象,所以这些 API 文档中的任何一个都在它上面工作:http://docs.stormpath.com/nodejs/api/application

我是这个库的开发者,希望对您有所帮助!