diff --git a/src/handlers/openid-configuration.ts b/src/handlers/openid-configuration.ts index 3eb4187..002b411 100644 --- a/src/handlers/openid-configuration.ts +++ b/src/handlers/openid-configuration.ts @@ -1,10 +1,11 @@ import type { HandlerOptions } from '../types.js' function handler(options: HandlerOptions) { - const { issuer, origin } = options + const { issuer, origin, jwksUriBaseUrl } = options return { issuer, - jwks_uri: `${origin}/api/auth/all-access/jwks.json`, + // TODO Need to sniff this or at least make it configurable + jwks_uri: `${origin}/${jwksUriBaseUrl}/jwks.json`, } } diff --git a/src/next-auth-all-access.ts b/src/next-auth-all-access.ts index d943119..b9fafdd 100644 --- a/src/next-auth-all-access.ts +++ b/src/next-auth-all-access.ts @@ -38,6 +38,7 @@ export function createInitializerOptions(options: NextAuthAllAccessOptions) { issuer, origin: getOrigin(options.origin), jwks, + jwksUriBaseUrl: options.jwksUriBaseUrl ?? 'oidc', } const signingOptions: CreateSigningFnsParameters = { diff --git a/src/types.ts b/src/types.ts index e0d3fb6..60afcb9 100644 --- a/src/types.ts +++ b/src/types.ts @@ -16,10 +16,12 @@ export interface NextAuthAllAccessOptions { privateKey?: string issuer?: string origin?: string + jwksUriBaseUrl?: string } export interface HandlerOptions { jwks: JSONWebKeySet + jwksUriBaseUrl: string issuer: string origin: string }