我总结的步骤总结如下。 我已经使用npm安装了Feathers js cli,并使用本地策略通过身份验证创建了feathers应用程序。 当我致电/ authentication时,响应说无效登录
我如何使用用户表中的用户服务评估用户并发送回带有选定字段的jwt令牌。
const { LocalStrategy } = require("@feathersjs/authentication-local");
const { expressOauth } = require("@feathersjs/authentication-oauth");
class MyLocalStrategy extends LocalStrategy {
async getEntityQuery(query, params) {
// Query for user but only include users marked as `active`
return {
...query,
//active: true,
$limit: 1,
};
}
}
module.exports = (app) => {
const authentication = new AuthenticationService(app);
const config = app.get("authentication");
authentication.register("jwt", new JWTStrategy());
// authentication.register("local", new LocalStrategy());
authentication.register("local", new MyLocalStrategy());
app.use("/authentication", authentication);
app.configure(expressOauth());
};