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

Document breaking changes in v7 #283

Closed
mirkonasato opened this issue Apr 23, 2022 · 7 comments
Closed

Document breaking changes in v7 #283

mirkonasato opened this issue Apr 23, 2022 · 7 comments

Comments

@mirkonasato
Copy link

Would be nice to have some instructions on how to upgrade from v6 to v7 in either the README or Changelog. The Changelog only mentions

Convert the project to typescript and improve typescript

which I took to mean it was an internal rewrite, with no breaking changes.

But as far as I can tell there at least these two major changes that require users to modify their code:

  1. The middleware function is now available as a named import rather than a default one: import { expressjwt } from 'express-jwt'
  2. The decoded JWT payload is now available as req.auth rather than req.user
@KillerCodeMonkey
Copy link

setting requestProperty is not available any more
and the interface for TokenGetter is not exported

@felixmosh
Copy link

isRevoked interface was changed, it passes the entire jwt instead of the payload only in the second argument, and there is no done as 3rd argument.

@LebonNic
Copy link

It would be nice if we could choose the name of the property that is used to store the token. For my part, the name auth is already used by another library which sets this value in the req object... So I have a collision between the two libraries and I can't update express-jwt.

@jfromaniello
Copy link
Member

jfromaniello commented Apr 25, 2022

released as express-jwt@7.5.0

@boobo94
Copy link

boobo94 commented Jan 4, 2023

Cannot set nested objects anymore using requestProperty, in v8 as working in v6.1.1.

v8.2.1 with requestProperty: 'payload.user', it does the following:

req: {
...
  payload: {
    foo: "bar"
  },
  "payload.user": object // the payload of token

...
}

Instead of adding user object in payload object, it creates a new property in req object with the name "payload.user".

@jfromaniello
Copy link
Member

@boobo94 thank you for reporting this, I've reverted to the previous behavior in v8.3.0.

@boobo94
Copy link

boobo94 commented Jan 4, 2023

@boobo94 thank you for reporting this, I've reverted to the previous behavior in v8.3.0.

everything works great. thanks for your help <3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants