File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -31,7 +31,12 @@ export default function SocialButtons({
3131
3232 const normalizedRoot = process . env . NEXT_PUBLIC_ROOT_URL . replace ( / \/ $ / , '' ) ;
3333
34- return `${ normalizedRoot } /auth/callback?next=${ encodeURIComponent ( pathname || '/' ) } ` ;
34+ // If we're on the sign-in page, redirect to home after successful login
35+ const nextPath = pathname ?. includes ( '/sign-in' )
36+ ? pathname . replace ( / \/ s i g n - i n .* $ / , '' ) || '/'
37+ : pathname || '/' ;
38+
39+ return `${ normalizedRoot } /auth/callback?next=${ encodeURIComponent ( nextPath ) } ` ;
3540 } , [ pathname ] ) ;
3641
3742 const socialButtons : SocialButton [ ] = [
Original file line number Diff line number Diff line change @@ -78,6 +78,6 @@ export async function proxy(
7878}
7979
8080export const config = {
81- // Matcher ignoring `/_next/`, `/api/` and `/assets/`
82- matcher : [ '/((?!api|assets|_next/static|_next/image|favicon.ico|public).*)' ] ,
81+ // Matcher ignoring `/_next/`, `/api/`, `/auth/` and `/assets/`
82+ matcher : [ '/((?!api|auth| assets|_next/static|_next/image|favicon.ico|public).*)' ] ,
8383} ;
You can’t perform that action at this time.
0 commit comments