Skip to content

Commit 24879ac

Browse files
committed
fix: auth redirect url
1 parent 5787dfb commit 24879ac

File tree

5 files changed

+5
-13
lines changed

5 files changed

+5
-13
lines changed

src/components/Auth/GoogleOAuthButton.tsx

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,26 @@ import { useToast } from "@/hooks/use-toast";
44
import { Button } from "@/components/ui/button";
55
import { Chrome, Loader2 } from "lucide-react";
66
import { useTranslation } from "react-i18next";
7+
import { useParams } from "react-router-dom";
78

89
interface GoogleOAuthButtonProps {
910
onSuccess?: () => void;
1011
onError?: (error: string) => void;
1112
inviteToken?: string;
1213
}
1314

14-
export function GoogleOAuthButton({
15-
onSuccess: _onSuccess,
16-
onError,
17-
inviteToken,
18-
}: GoogleOAuthButtonProps) {
15+
export function GoogleOAuthButton({ onSuccess: _onSuccess, onError }: GoogleOAuthButtonProps) {
1916
const [isLoading, setIsLoading] = useState(false);
17+
const { slug } = useParams<{ slug: string }>();
2018
const { t } = useTranslation("auth");
2119
const { toast } = useToast();
2220

2321
const handleGoogleSignIn = async () => {
2422
setIsLoading(true);
2523
try {
2624
// Include invite token in redirect URL for tenant flows
27-
const redirectTo = inviteToken
28-
? `${window.location.origin}/auth/callback?inviteToken=${inviteToken}`
29-
: `${window.location.origin}/auth/callback`;
30-
25+
const authPath = slug ? `/tenant/${slug}/auth` : "/auth";
26+
const redirectTo = window.location.origin + authPath;
3127
const { data: _data, error } = await supabase.auth.signInWithOAuth({
3228
provider: "google",
3329
options: {

src/components/Auth/JoinTenantSignInForm.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ export function JoinTenantSignInForm({
9898
variant: "destructive",
9999
});
100100
}}
101-
inviteToken={inviteToken}
102101
/>
103102

104103
<OAuthDivider />

src/components/Auth/JoinTenantSignUpForm.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@ export function JoinTenantSignUpForm({
134134
variant: "destructive",
135135
});
136136
}}
137-
inviteToken={inviteToken}
138137
/>
139138

140139
<OAuthDivider />

src/components/Auth/SignInForm.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,6 @@ export function SignInForm({
207207
variant: "destructive",
208208
})
209209
}
210-
inviteToken={inviteToken}
211210
/>
212211

213212
<OAuthDivider />

src/components/Auth/SignUpForm.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,6 @@ export function SignUpForm({
164164
variant: "destructive",
165165
});
166166
}}
167-
inviteToken={inviteToken}
168167
/>
169168

170169
<OAuthDivider />

0 commit comments

Comments
 (0)