@delmaredigital/payload-better-auth 0.6.5 → 0.6.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/plugin/index.js +7 -2
- package/package.json +1 -1
package/dist/plugin/index.js
CHANGED
|
@@ -560,11 +560,16 @@ let apiKeyPermissionsConfig = undefined;
|
|
|
560
560
|
try {
|
|
561
561
|
const { verifyAccessToken } = await import('better-auth/oauth2');
|
|
562
562
|
const baseURL = auth.options?.baseURL;
|
|
563
|
+
const basePath = auth.options?.basePath || '/api/auth';
|
|
563
564
|
if (!baseURL) throw new Error('baseURL not configured');
|
|
565
|
+
// issuer = baseURL + basePath (e.g., https://example.com/api/auth)
|
|
566
|
+
// audience = baseURL (e.g., https://example.com) — the resource server
|
|
567
|
+
// jwks = issuer + /jwks
|
|
568
|
+
const issuer = `${baseURL}${basePath}`;
|
|
564
569
|
const jwtPayload = await verifyAccessToken(token, {
|
|
565
|
-
jwksUrl: `${
|
|
570
|
+
jwksUrl: `${issuer}/jwks`,
|
|
566
571
|
verifyOptions: {
|
|
567
|
-
issuer
|
|
572
|
+
issuer,
|
|
568
573
|
audience: baseURL
|
|
569
574
|
}
|
|
570
575
|
});
|