Skip to content
This repository was archived by the owner on Aug 29, 2018. It is now read-only.

Cannot authenticate using feathers token #43

Closed
jsn0ob opened this issue Oct 30, 2017 · 16 comments
Closed

Cannot authenticate using feathers token #43

jsn0ob opened this issue Oct 30, 2017 · 16 comments

Comments

@jsn0ob
Copy link

jsn0ob commented Oct 30, 2017

app runs smoothly on my local but after deploying my app to server, calling feathersApp.authenticate() returns error:

Bad "options.jwtid" option. The payload already has an "jti" property.

@jsn0ob
Copy link
Author

jsn0ob commented Oct 30, 2017

i tried downgrading feathers-authentication to version 1.2.7 and it worked.

@daffl
Copy link
Member

daffl commented Oct 30, 2017

Probably a regression due to feathersjs-ecosystem/authentication#539 Are you overriding the jwtid in production?

@jsn0ob
Copy link
Author

jsn0ob commented Oct 31, 2017

i was not. it might be due to jsonwebtoken update, but i'm not sure.

https://github.com/auth0/node-jsonwebtoken/blob/master/CHANGELOG.md

@EirikFA
Copy link

EirikFA commented Nov 1, 2017

I have the same issue but it occurs both in development and production.

@daffl
Copy link
Member

daffl commented Nov 1, 2017

Can someone please share a reproducible example?

@EirikFA
Copy link

EirikFA commented Nov 1, 2017

I can try to set one up. Shouldn't take long. Just make a service that creates a JWT with createJWT.

@daffl
Copy link
Member

daffl commented Nov 2, 2017

What are you calling createJWT for? There might be a good reason but Feathers authentication should normally not require you to ever do that directly.

@EirikFA
Copy link

EirikFA commented Nov 2, 2017

I have a service that issues JWTs to clients that call it with an API key. Reason for this is that the clients aren't real "clients", but other servers.

@subodhpareek18
Copy link

subodhpareek18 commented Nov 2, 2017

@FreeLineTM why don't you use a custom auth module using passport-custom for api key authentication. I use it to completely circumvent creating JWTs. I've added it to the docs here feathersjs-ecosystem/docs#885

@daffl could you please review and merge it? I think there has been some conflict introduced since I last put it up.

@EirikFA
Copy link

EirikFA commented Nov 2, 2017

@subodhpareek18 I didn't know how to do that and the solution I'm using was a suggestion from someone else. Didn't have any better ideas myself. Will take a look at your PR and try that out though.

@nathanbrizzee
Copy link

I'm having the same problem I was running feathers-authentication 1.2.7 on my server and everything was fine. I upgraded today and I get the same error now. My client is using feathers-authentication 1.3.0 with no issues before the update so it's something that was introduced between 1.2.7 and 1.3.0.

@nathanbrizzee
Copy link

Here is a copy of the error: (I get it when I open a new tab to the same URL. The JWT is re-read from window.localstorage and checked to see if it's still valid. The new window tab is the one that throws the server error, not the original one).
And my package.json diff:
feathers-error

info: error: authentication - Method: create: Bad "options.jwtid" option. The payload already has an "jti" property.
error: Error: Bad "options.jwtid" option. The payload already has an "jti" property.
at C:\code\jsapi\server\node_modules\feathers-authentication\node_modules\jsonwebtoken\sign.js:165:24
at Array.forEach ()
at Object.module.exports [as sign] (C:\code\jsapi\server\node_modules\feathers-authentication\node_modules\jsonwebtoken\sign.js:161:35)
at C:\code\jsapi\server\node_modules\feathers-authentication\lib\utils.js:54:28
at Promise ()
at Authenticator.createJWT (C:\code\jsapi\server\node_modules\feathers-authentication\lib\utils.js:46:10)
at Object.create (C:\code\jsapi\server\node_modules\feathers-authentication\lib\service.js:48:28)
at C:\code\jsapi\server\node_modules\feathers-hooks\lib\hooks.js:101:31
at Promise ()
at C:\code\jsapi\server\node_modules\feathers-hooks\lib\hooks.js:85:16
at
at process._tickCallback (internal/process/next_tick.js:188:7)

@daffl
Copy link
Member

daffl commented Nov 3, 2017

I have a fix in feathersjs-ecosystem/authentication#600 which should be released shortly.

@daffl
Copy link
Member

daffl commented Nov 3, 2017

Closed via feathersjs-ecosystem/authentication#600

@daffl daffl closed this as completed Nov 4, 2017
@jsn0ob
Copy link
Author

jsn0ob commented Nov 7, 2017

thanks @daffl! 💯

@nathanbrizzee
Copy link

It now works for me. Thank you so much for the quick turn around!

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants