使用这样的自定义登录时,是否可以添加基于用户的数据?我正在使用自定义身份验证模块。像这个例子:
module.exports = {
type: "credentials",
authenticate: function(username,password) {
return new Promise(function(resolve) {
// Do whatever work is needed to validate the username/password
// combination.
if (valid) {
// Resolve with the user object. Equivalent to having
// called users(username);
var user = { username: "admin", permissions: "*", customData: 'data' };
resolve(user);
} else {
// Resolve with null to indicate the username/password pair
// were not valid.
resolve(null);
}
});
},
}
我想向用户模型添加令牌。但是看起来用户模型删除了其他对象参数。