Skip to content

Commit 391a01b

Browse files
committed
fix: oauth login
1 parent d7200b7 commit 391a01b

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

app/[lang]/sign-in/SocialButtons.tsx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,22 @@ export default function SocialButtons({
2525
const supabase = getSupabaseBrowserClient();
2626
const pathname = usePathname();
2727
const oauthRedirectUrl = useMemo(() => {
28-
if (!process.env.NEXT_PUBLIC_ROOT_URL) {
29-
return undefined;
30-
}
28+
const lang = pathname?.split('/')[1] || 'en';
29+
const base =
30+
(typeof window !== 'undefined' && window.location.origin) ||
31+
process.env.NEXT_PUBLIC_ROOT_URL;
3132

32-
const normalizedRoot = process.env.NEXT_PUBLIC_ROOT_URL.replace(/\/$/, '');
33+
if (!base) return undefined;
34+
35+
const normalizedBase = base.replace(/\/$/, '');
3336

3437
// If we're on the sign-in page, redirect to home after successful login
3538
const nextPath = pathname?.includes('/sign-in')
3639
? pathname.replace(/\/sign-in.*$/, '') || '/'
3740
: pathname || '/';
3841

39-
return `${normalizedRoot}/auth/callback?next=${encodeURIComponent(nextPath)}`;
42+
const nextParam = encodeURIComponent(nextPath);
43+
return `${normalizedBase}/auth/callback?next=${nextParam}&lang=${lang}`;
4044
}, [pathname]);
4145

4246
const socialButtons: SocialButton[] = [

styles/output.css

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1499,11 +1499,6 @@ input[type='search']::-webkit-search-decoration,
14991499
min-width: 70px;
15001500
}
15011501

1502-
.min-w-fit {
1503-
min-width: -moz-fit-content;
1504-
min-width: fit-content;
1505-
}
1506-
15071502
.min-w-full {
15081503
min-width: 100%;
15091504
}
@@ -1664,6 +1659,10 @@ input[type='search']::-webkit-search-decoration,
16641659
justify-content: flex-start;
16651660
}
16661661

1662+
.justify-end {
1663+
justify-content: flex-end;
1664+
}
1665+
16671666
.justify-center {
16681667
justify-content: center;
16691668
}

0 commit comments

Comments
 (0)