Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No Auth token on authentication resource #488

waldemarnt opened this Issue Apr 21, 2017 · 4 comments


None yet
2 participants
Copy link

waldemarnt commented Apr 21, 2017

I just generated the JWT authentication strategy via CLI and when I try to authenticate with the following request:

curl -X POST \
  http://localhost:3030/authentication \
  -H 'cache-control: no-cache' \
  -H 'content-type: application/json' \
  -d '{
"email": "",
"password": "password"

The answer is:

  "name": "NotAuthenticated",
  "message": "No auth token",
  "code": 401,
  "className": "not-authenticated",
  "data": {},
  "errors": {}

And the debug log says:

Fri, 21 Apr 2017 21:28:49 GMT feathers-authentication:passport:authenticate Authentication strategy 'jwt' failed Error: No auth token
    at JwtStrategy.authenticate (/home/app/tagger/node_modules/passport-jwt/lib/strategy.js:87:26)
    at /home/app/tagger/node_modules/feathers-authentication/lib/passport/authenticate.js:131:18
    at /home/app/tagger/node_modules/feathers-authentication/lib/passport/authenticate.js:38:14
    at Object.<anonymous> (/home/app/tagger/node_modules/feathers-authentication/lib/hooks/authenticate.js:80:55)
    at process._tickCallback (internal/process/next_tick.js:103:7) undefined

This is my actual configuration

Fri, 21 Apr 2017 21:28:49 GMT feathers-authentication:hooks:authenticate Attempting to authenticate using jwt strategy with options { name: 'jwt',
  bodyKey: 'accessToken',
  secret: 'a big secret',
  header: 'Authorization',
  entity: 'user',
  service: 'users',
  passReqToCallback: true,
  session: false,
   { header: { typ: 'access', type: 'access' },
     audience: 'localhost:3030',
     subject: 'anonymous',
     issuer: 'feathers',
     algorithm: 'HS256',
     expiresIn: '1d' } }

Have someone else faced this issue? Seems that the /authentication route is under protection.


This comment has been minimized.

Copy link

waldemarnt commented Apr 21, 2017

Fixed, I had to comment this line:

  before: {
    create: [
      // You can chain multiple strategies
      auth.hooks.authenticate(['jwt', 'local']),
    remove: [

I don't understand why this was generated :)

@waldemarnt waldemarnt closed this Apr 21, 2017


This comment has been minimized.

Copy link

marshallswain commented Apr 22, 2017

@waldemarnt that was not a fix. You need to leave that line in place or you basically enable anonymous authentication. We have an open issue to remove the implicit anonymous auth. You've generated a token with no user attached. The real solution would be to make sure you pass a strategy in the payload, as mentioned in the API docs.


This comment has been minimized.

Copy link

waldemarnt commented Apr 22, 2017

@marshallswain thank you, I trying to figure out how those strategies work, I couldn't found on the documentation :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.