auth0 / node-jsonwebtoken

JsonWebToken implementation for node.js http://self-issued.info/docs/draft-ietf-oauth-json-web-token.html
MIT License
17.71k stars 1.23k forks source link

Support for Vercel Edge Runtime #864

Open MerlinMason opened 1 year ago

MerlinMason commented 1 year ago

Describe the problem you'd like to have solved

I'm currently using NextJS with it's Middleware feature which runs in the Vercel Edge Runtime - I would like to be able to verify JWTs here but due to the restrictions of the runtime it appears jsonwebtoken is not compatible.

Describe the ideal solution

Either compatibility with the whole library or a lighter weight verify function that can be used in this runtime.

Alternatives and current work-arounds

The jose library supports this, but isn't compatible with Jest which we rely on heavily.

panva commented 1 year ago

isn't compatible with Jest which we rely on heavily

jose most certainly is compatible with any test runtime that exhibits the behaviours, globals, and module resolution representative of the actual target runtime. I'd be curious to learn more about your issue.

Nevertheless, if jsonwebtoken were made to be Vercel Edge Runtime compatible it would undeniably have to depend on the same Web API primitives jose relies on, leading to the same incompatibility with your jest setup.

bablukpik commented 1 year ago

It needs to be compatible with Vercel Edge runtime as soon as possible

brendanmoore commented 8 months ago

Anyone else arriving here: Check out this hero! https://github.com/vercel/next.js/issues/43115#issuecomment-1321785193