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

Authentication token is missing #352

Gert25 opened this Issue Nov 25, 2016 · 2 comments


None yet
1 participant
Copy link

Gert25 commented Nov 25, 2016

Hey Guys

So have been hacking away on this problem since yesterday...and I can't seem to find the problem here. I was wondering if you guys might have some tips as to how I can further debug this issue.

problem statement

I have a feathers-rest service setup with some of the endpoints that I restricted with the feathers-authentication hooks. Now when I login I do receive the JWT token, but when I use this token to authenticate the action I got an Error message back that says the following "message":"Authentication token missing.". I send the token via the HTTP authorization header as specified by my config file. And I have checked XHR request header to see if the token is been send. And everything seems fine. So I don't know why the verifyToken() hook sends back the missing token message.

here is an example output of a console log on my feathers app's settings.auth

  shouldSetupSuccessRoute: 'false',
  shouldSetupFailureRoute: 'false',
  successRedirect: '/auth/success',
  failureRedirect: '/auth/failure',
  tokenEndpoint: '/auth/token',
  localEndpoint: '/auth/local',
  userEndpoint: '/users',
  header: 'authorization',
  cookie: { name: 'feathers-jwt', httpOnly: false, secure: false },
  token: { secret: 'xFsUsFG+/a+q2ee8wNuo4ZSE+FOxyqR9+tE4ck3fKX4K8VZneYOEQYOmsbQqZbukUw+Bu9MYg2jFLpS//Ch2bA==' },
  local: { usernameField: 'email' } }

I can send you guys further gist and any information you guys need, but I am happy enough to fix my own issues. It is just I do not know how to further debug this problem. Any tips?


This comment has been minimized.

Copy link

Gert25 commented Nov 25, 2016

So have made some progress on the issue. I have hacked around on the source code for feathers-authentication looking for the source of the problem. So the error message is generated in the /lib/hooks/verify-token.js on line 21. it appears it is looking for the token in the hook.params.token. So I have console.log the variable and it appears to be undefined. I am sending my token via the http headers using axios. The reason I am not using feathers-client is that the service is a stand-alone service on a separate server so it needs to work via XHR request...for client purposes. So using feathers-client is not a solution. So how do get the token into hook.params without actually posting through form data?


This comment has been minimized.

Copy link

Gert25 commented Nov 28, 2016

I have manage to sort out the issue. I rearranged the order in which my feathers app was configured. I moved my feathers-rest and feathers-hooks config before the body parser thanks to the tip from one of my senior developers. It seems that the body parser might of been eating up my authorisation header. Not sure how though but everything seems to work after reordered the way the app was configured.

@Gert25 Gert25 closed this Nov 28, 2016

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.