Fix Google OAuth redirect in production
The Google OAuth redirect was failing in production due to `window.location.origin` resolving to `localhost:3000`. This commit fixes the redirect logic in `src/components/auth/SocialLoginButtons.tsx` and updates the `public.handle_new_user()` function via a SQL migration (`supabase/migrations/20250621141237-fix-google-user-data.sql`) to capture the user's name from Google metadata.
This commit is contained in:
parent
8afd392018
commit
9427d396b6
@ -14,10 +14,20 @@ const SocialLoginButtons = () => {
|
||||
console.log('🔐 Iniciando login com Google...');
|
||||
console.log('🌐 URL atual:', window.location.origin);
|
||||
|
||||
// Determinar a URL de redirecionamento correta
|
||||
const redirectUrl = window.location.hostname === 'localhost'
|
||||
? 'http://localhost:3000/'
|
||||
: `${window.location.origin}/`;
|
||||
// Determinar a URL de redirecionamento correta baseada no hostname
|
||||
let redirectUrl;
|
||||
const hostname = window.location.hostname;
|
||||
|
||||
if (hostname === 'localhost') {
|
||||
redirectUrl = 'http://localhost:3000/';
|
||||
} else if (hostname.includes('financehome.innova1001.com.br')) {
|
||||
redirectUrl = 'https://financehome.innova1001.com.br/';
|
||||
} else if (hostname.includes('lovableproject.com')) {
|
||||
redirectUrl = `${window.location.origin}/`;
|
||||
} else {
|
||||
// Fallback para qualquer outro domínio
|
||||
redirectUrl = `${window.location.origin}/`;
|
||||
}
|
||||
|
||||
console.log('🔗 URL de redirecionamento:', redirectUrl);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user