Skip to content

Commit 48f10f5

Browse files
kaioduartendom91ThangHuuVu
authored
fix(next-auth): add code to client SignInResponse (#10943)
add error code to SignInResponse Co-authored-by: Nico Domino <[email protected]> Co-authored-by: Thang Vu <[email protected]>
1 parent 656f1ec commit 48f10f5

File tree

3 files changed

+5
-0
lines changed

3 files changed

+5
-0
lines changed

packages/next-auth/src/lib/client.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ export interface SignInOptions extends Record<string, unknown> {
6060

6161
export interface SignInResponse {
6262
error: string | undefined
63+
code: string | undefined
6364
status: number
6465
ok: boolean
6566
url: string | null

packages/next-auth/src/react.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,13 +286,15 @@ export async function signIn<
286286
}
287287

288288
const error = new URL(data.url).searchParams.get("error")
289+
const code = new URL(data.url).searchParams.get("code")
289290

290291
if (res.ok) {
291292
await __NEXTAUTH._getSession({ event: "storage" })
292293
}
293294

294295
return {
295296
error,
297+
code,
296298
status: res.status,
297299
ok: res.ok,
298300
url: error ? null : data.url,

packages/next-auth/src/webauthn.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,13 +147,15 @@ export async function signIn<
147147
}
148148

149149
const error = new URL(data.url).searchParams.get("error")
150+
const code = new URL(data.url).searchParams.get("code")
150151

151152
if (res.ok) {
152153
await __NEXTAUTH._getSession({ event: "storage" })
153154
}
154155

155156
return {
156157
error,
158+
code,
157159
status: res.status,
158160
ok: res.ok,
159161
url: error ? null : data.url,

0 commit comments

Comments
 (0)