Fix OIDC endpoint URLs to include /oidc prefix

Configure oidc-provider routes with explicit /oidc prefix so the
discovery document and token endpoints resolve correctly. Previously
the catch-all stripped the prefix, causing the provider to generate
URLs without it.
This commit is contained in:
Jennie Robinson Faber 2026-03-01 16:41:38 +00:00
parent 8a529a8e7c
commit a055874680
2 changed files with 18 additions and 4 deletions

View file

@ -14,10 +14,8 @@ export default defineEventHandler(async (event) => {
const provider = await getOidcProvider();
const { req, res } = event.node;
// oidc-provider expects paths relative to its own mount point.
// Nitro gives us the full path, so strip the /oidc prefix.
const originalUrl = req.url || "";
req.url = originalUrl.replace(/^\/oidc/, "") || "/";
// The provider's routes config includes the /oidc prefix,
// so pass the full path through without stripping.
// Hand off to oidc-provider's Connect-style callback
const callback = provider.callback() as Function;