Skip to content

Commit

Permalink
fix: incorrect signin redirect url on session required (#5976)
Browse files Browse the repository at this point in the history
Fixes #5296
  • Loading branch information
mscerri committed Dec 19, 2022
1 parent 54cbbad commit 6242aa7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/next-auth/src/react/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ export function useSession<R extends boolean>(options?: UseSessionOptions<R>) {

React.useEffect(() => {
if (requiredAndNotLoading) {
const url = `/api/auth/signin?${new URLSearchParams({
const baseUrl = apiBaseUrl(__NEXTAUTH)
const url = `${baseUrl}/signin?${new URLSearchParams({
error: "SessionRequired",
callbackUrl: window.location.href,
})}`
Expand Down

1 comment on commit 6242aa7

@vercel
Copy link

@vercel vercel bot commented on 6242aa7 Dec 19, 2022

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.