mikenicholson / passport-jwt

Passport authentication using JSON Web Tokens
MIT License
1.97k stars 214 forks source link

request header cookie empty after authentication #96

Closed peacemakr closed 7 years ago

peacemakr commented 7 years ago

I want to convert jwt authenticated user's session into regular cookie based session after authentication. Here is what I am doing:

app.get( '/some_route', passport.authenticate( 'jwt', { session: true }), handler );

I am using session: true instead. However after successful authentication, I still get empty req.headers.cookie on next requests from the same user. Are there other options that need to be provided?

peacemakr commented 7 years ago

To add to the above, I also tried req.login inside the handler function but still no luck

jarodsmk commented 7 years ago

@peacemakr Hey there,

Was wondering if you got around this?

I've spent a couple days myself looking into a similar issue and wondering whether the passport-jwt library was meant to be used with {session: true}.

mikenicholson commented 7 years ago

Are you still having an issue with this?

jwt's are really intended to provide sessionless auth so using them with sessions doesn't necessarily make a ton of sense.

If you have code that demonstrates a problem with passport-jwt or can add a test that should be passing that would help with reproducing and solving your issue.

jarodsmk commented 7 years ago

@themikenicholson

I moved to using sessions only and removed JWT as the requirements changed, but I agree, looking back it didn't make a ton of sense to use JWT for session handling