Support edge runtime compatibility (#1)#172
Support edge runtime compatibility (#1)#172kaaloo wants to merge 5 commits intostefanprokopdev:mainfrom
Conversation
* Use jose instead of jwks-rsa. Still need to verify nonce. * Verify nonce manually since there is no built-in support in jose * Replace jsonwebtoken by jose too * Mark as 3.0.1-jose version * Reset to previous package version * Ignore vscode settings * Use jose's decodeProjectedHeader for alg and kid * Fix tests
|
@stefanprokopdev please review this PR when you have a moment. I can get by for my needs for the moment by using my fork. |
|
Hey @kaaloo 👋 Thanks for the PR, it looks good to me! Could you please run the |
|
Hi @stefanprokopdev , thanks for your quick review! I updated my PR accordingly. |
|
Thanks @kaaloo ! Are there any breaking changes? For example camelCase changed to snake_case or whatever? Just asking if are 100 % backward compatible or we need more changes or improvements (case sensitivity for example). I am not able to test it now because I dont have an active project 😞 |
|
Hi, good question 😅 I unfortunately am not going with this in our project because I discovered an experimental supabase auth API that covers the full scope of my use case. Have you had issues with this type of breakage in the past? |
stefanprokopdev
left a comment
There was a problem hiding this comment.
There are just some minor request changes we can discuss.
|
Hi @stefanprokopdev sorry I've been travelling and had not had a moment to code. Will look at this shortly. Thanks for your careful review! |
Should be undefined but sound good to make sure Co-authored-by: Štefan Prokop <sprokop1010@seznam.cz>
Best practice not to log nonce values Co-authored-by: Štefan Prokop <sprokop1010@seznam.cz>
When attempting to use the current 3.0.1 verify-apple-id-token package in the Vercel Edge Runtime an error appears at build time related to the use of dynamic evaluation:
https://nextjs.org/docs/messages/edge-dynamic-code-evaluation
This PR provides a solution to this issue by replacing the jsonwebtoken and jwks-rsa libraries by jose which provides the same functionality in a single well supported package with albeit a slightly different API.
In this context, jose has the important characteristic of being compatible with various edge runtimes including Vercel's.
https://github.com/panva/jose#supported-runtimes
Fixes #171