Skip to content

Commit 2432ce9

Browse files
committed
fix: throw error on missing state
1 parent 0a689b4 commit 2432ce9

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

packages/next-auth/src/core/lib/oauth/state-handler.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ export async function useState(
4949
): Promise<{ value: string; cookie: Cookie } | undefined> {
5050
const { cookies, provider, jwt } = options
5151

52-
if (!provider.checks?.includes("state") || !state) return
52+
if (!provider.checks?.includes("state")) return
53+
54+
if (!state) throw new Error("No state provided")
5355

5456
const value = (await jwt.decode({ ...options.jwt, token: state })) as any
5557

0 commit comments

Comments
 (0)