Skip to content

Commit

Permalink
fix: throw error on missing state
Browse files Browse the repository at this point in the history
  • Loading branch information
balazsorban44 committed Mar 2, 2023
1 parent 0a689b4 commit 2432ce9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/next-auth/src/core/lib/oauth/state-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ export async function useState(
): Promise<{ value: string; cookie: Cookie } | undefined> {
const { cookies, provider, jwt } = options

if (!provider.checks?.includes("state") || !state) return
if (!provider.checks?.includes("state")) return

if (!state) throw new Error("No state provided")

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

Expand Down

1 comment on commit 2432ce9

@vercel
Copy link

@vercel vercel bot commented on 2432ce9 Mar 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.