我正在使用Stormpath和Express,我想访问特定用户的自定义数据,这些数据存在于数据库中,而不是以该用户的身份登录。这将在管理风格的UI中使用,其中具有某些特权的用户可以编辑其他用户的自定义数据。
如何像使用req.user.customData
访问当前用户的数据那样访问特定用户的数据
发布于 2015-02-07 01:59:56
如果您使用的是速递库,您可以这样做:
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
我是这个库的开发者,希望这能帮上忙!
https://stackoverflow.com/questions/28379178
复制