node.jsgoogle-app-enginefeathersjsgoogle-appengine-node

Authentication strategy 'jwt' is not registered


Steps to reproduce

I deployed my featherjs sample project that required authentication to Google Appengine and I get the following error message:

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

My app engine logs show the following:

error: BadRequest: Authentication strategy 'jwt' is not registered. at new BadRequest (/srv/node_modules/@feathersjs/errors/lib/index.js:86:17) at Object. (/srv/node_modules/@feathersjs/authentication/lib/hooks/authenticate.js:41:29) at promise.then.hookObject (/srv/node_modules/@feathersjs/commons/lib/hooks.js:167:73) at < anonymous >

Is there anyway to force register JWT? This works fine in my featherjs dev environment so there isn't anything wrong with the setup for a normal environment just wondering if anyone had any suggestions on how to get it running.


Solution

  • This seemed to solve my issue

    app.service('authentication').hooks({
        before: {
          create: [
            authentication.hooks.authenticate(app.get('auth').strategies)
          ],
          remove: authentication.hooks.authenticate('jwt')
        }
    });