0

重现步骤

我部署了需要对 Google Appengine 进行身份验证的 featherjs 示例项目,我收到以下错误消息:

{
    "name": "BadRequest",
    "message": "Authentication strategy 'jwt' is not registered.",
    "code": 400,
    "className": "bad-request",
    "errors": {}
}

我的应用引擎日志显示以下内容:

错误:BadRequest:未注册身份验证策略“jwt”。在对象的新 BadRequest (/srv/node_modules/@feathersjs/errors/lib/index.js:86:17) 处。(/srv/node_modules/@feathersjs/authentication/lib/hooks/authenticate.js:41:29) 在 promise.then.hookObject (/srv/node_modules/@feathersjs/commons/lib/hooks.js:167:73)在 <匿名>

无论如何强制注册JWT?这在我的 featherjs 开发环境中运行良好,因此正常环境的设置没有任何问题,只是想知道是否有人对如何使其运行有任何建议。

4

1 回答 1

3

似乎解决了我的问题

app.service('authentication').hooks({
    before: {
      create: [
        authentication.hooks.authenticate(app.get('auth').strategies)
      ],
      remove: authentication.hooks.authenticate('jwt')
    }
});
于 2018-06-21T17:01:00.963 回答