You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fixed JWT public key caching in `verifyToken()` to support multi-instance scenarios. Public keys are now correctly cached per `kid` from the token header instead of using a single shared cache key.
7
+
8
+
**What was broken:**
9
+
10
+
When verifying JWT tokens with the `jwtKey` option (PEM public key), all keys were cached under the same cache key. This caused verification failures in multi-instance scenarios.
11
+
12
+
**What's fixed:**
13
+
14
+
JWT public keys are now cached using the `kid` value from each token's header.
* Used to verify the session token in a networkless manner. Supply the PEM public key from the **[**API keys**](https://dashboard.clerk.com/last-active?path=api-keys) page -> Show JWT public key -> PEM Public Key** section in the Clerk Dashboard. **It's recommended to use [the environment variable](https://clerk.com/docs/guides/development/clerk-environment-variables) instead.** For more information, refer to [Manual JWT verification](https://clerk.com/docs/guides/sessions/manual-jwt-verification).
29
-
*/
30
-
jwtKey?: string;
31
-
};
26
+
exporttypeVerifyTokenOptions=Simplify<
27
+
Omit<VerifyJwtOptions,'key'>&
28
+
Omit<LoadClerkJWKFromRemoteOptions,'kid'>&{
29
+
/**
30
+
* Used to verify the session token in a networkless manner. Supply the PEM public key from the **[**API keys**](https://dashboard.clerk.com/last-active?path=api-keys) page -> Show JWT public key -> PEM Public Key** section in the Clerk Dashboard. **It's recommended to use [the environment variable](https://clerk.com/docs/guides/development/clerk-environment-variables) instead.** For more information, refer to [Manual JWT verification](https://clerk.com/docs/guides/sessions/manual-jwt-verification).
31
+
*/
32
+
jwtKey?: string;
33
+
}
34
+
>;
32
35
33
36
/**
34
37
* > [!WARNING]
@@ -121,10 +124,10 @@ export async function verifyToken(
0 commit comments