Skip to content

Commit dd211c5

Browse files
RegloomThangHuuVu
andauthored
fix(core): undefined providerId (#12947)
* Fix undefined providerId Client-side auth with no `providerId` param results in error. * dev: Add test for 'undefined' provider url-parsing.test.ts * simplify tests * formatting --------- Co-authored-by: Thang Vu <[email protected]>
1 parent 53b445f commit dd211c5

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

packages/core/src/lib/utils/web.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,5 +144,8 @@ export function parseActionAndProviderId(
144144
)
145145
throw new UnknownAction(`Cannot parse action at ${pathname}`)
146146

147-
return { action, providerId }
147+
return {
148+
action,
149+
providerId: providerId == "undefined" ? undefined : providerId,
150+
}
148151
}

packages/core/test/url-parsing.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,12 @@ describe("parse the action and provider id", () => {
7070
providerId: "auth0",
7171
basePath: "/auth",
7272
},
73+
{
74+
path: "/auth/signin/undefined",
75+
action: "signin",
76+
providerId: undefined,
77+
basePath: "/auth",
78+
},
7379
])("$path", ({ path, error, basePath, action, providerId }) => {
7480
if (action || providerId) {
7581
const parsed = parseActionAndProviderId(path, basePath)

0 commit comments

Comments
 (0)