diff --git a/packages/core/src/lib/utils/web.ts b/packages/core/src/lib/utils/web.ts index 9e782978bb..fdbafbcadc 100644 --- a/packages/core/src/lib/utils/web.ts +++ b/packages/core/src/lib/utils/web.ts @@ -144,5 +144,8 @@ export function parseActionAndProviderId( ) throw new UnknownAction(`Cannot parse action at ${pathname}`) - return { action, providerId } + return { + action, + providerId: providerId == "undefined" ? undefined : providerId, + } } diff --git a/packages/core/test/url-parsing.test.ts b/packages/core/test/url-parsing.test.ts index 330b6384f0..d978b37fe7 100644 --- a/packages/core/test/url-parsing.test.ts +++ b/packages/core/test/url-parsing.test.ts @@ -70,6 +70,12 @@ describe("parse the action and provider id", () => { providerId: "auth0", basePath: "/auth", }, + { + path: "/auth/signin/undefined", + action: "signin", + providerId: undefined, + basePath: "/auth", + }, ])("$path", ({ path, error, basePath, action, providerId }) => { if (action || providerId) { const parsed = parseActionAndProviderId(path, basePath)