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

feat(jwt): support for getting payload from c.get('jwtPayload') #1025

Merged
merged 5 commits into from
Mar 31, 2023

Conversation

yusukebe
Copy link
Member

@yusukebe yusukebe commented Mar 31, 2023

Copied from #1013.


This PR will add support for getting the decoded payload from c.get('jwtPaload') for JWT Auth Middleware.

app.post(
  '/auth/abc',
  jwt({
    secret: 'a-secret',
  }),
  (c) => {
    const payload = c.get('jwtPayload')
    //...
  }
)

This will resolve #810 #1005

Does it include breaking changes?

The verify() API in utils/jwt/jwt.ts has been changed. It will return any instead of boolean. This seems to be a breaking change, but this function is mainly "utility" used in the Hono internal. We should release the fix, including breaking changes as major version up, but this change will not affect end users. EDIT I'd like to release it as a minor version up "3.2.0".

EDIT:

We can release this with a patch release.

  • Utilities such as utils/url.ts are broken and changed without notice. utilities are intended to be used internally and may be changed in patch releases. Same for `utils/jwt/jwt.ts.
  • It is not a major feature addition, and we don't have to include it in the Minor or Major release.

@yusukebe yusukebe merged commit e6669f7 into main Mar 31, 2023
@yusukebe yusukebe deleted the feat/jwt-payload branch March 31, 2023 09:39
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

Successfully merging this pull request may close these issues.

Support for decoding JWT
1 participant