verify-apple-id-token icon indicating copy to clipboard operation
verify-apple-id-token copied to clipboard

Support edge runtime compatibility (#1)

Open kaaloo opened this issue 1 year ago • 6 comments

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

kaaloo avatar Jun 18 '23 18:06 kaaloo

@stefanprokopdev please review this PR when you have a moment. I can get by for my needs for the moment by using my fork.

kaaloo avatar Jun 18 '23 18:06 kaaloo

Hey @kaaloo :wave: Thanks for the PR, it looks good to me!

Could you please run the npm run format script? I think some of the code parts should be reformatted an there is also a missing EOL whitespace (in package.json). Would you be so nice and take a look at this stuff? We can merge it then :tada:

stefanprokopdev avatar Jun 19 '23 09:06 stefanprokopdev

Hi @stefanprokopdev , thanks for your quick review! I updated my PR accordingly.

kaaloo avatar Jun 19 '23 11:06 kaaloo

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 :disappointed:

stefanprokopdev avatar Jun 19 '23 11:06 stefanprokopdev

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?

kaaloo avatar Jun 19 '23 12:06 kaaloo

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!

kaaloo avatar Jun 27 '23 08:06 kaaloo