diff --git a/src/contexts/AuthContext.tsx b/src/contexts/AuthContext.tsx index 02c77dc..5464709 100644 --- a/src/contexts/AuthContext.tsx +++ b/src/contexts/AuthContext.tsx @@ -1,7 +1,7 @@ import { createContext, useContext, useState, useEffect, ReactNode } from 'react'; import { supabase } from '@/integrations/supabase/client'; -import { Session, User, Provider } from '@supabase/supabase-js'; +import { Session, User } from '@supabase/supabase-js'; import { useToast } from '@/hooks/use-toast'; type AuthContextType = { @@ -11,7 +11,6 @@ type AuthContextType = { loading: boolean; signIn: (email: string, password: string) => Promise; signUp: (email: string, password: string, fullName: string) => Promise; - signInWithProvider: (provider: Provider) => Promise; signOut: () => Promise; }; @@ -129,31 +128,6 @@ export const AuthProvider = ({ children }: { children: ReactNode }) => { } }; - const signInWithProvider = async (provider: Provider) => { - try { - setLoading(true); - const { error } = await supabase.auth.signInWithOAuth({ - provider, - options: { - redirectTo: window.location.origin + '/dashboard' - } - }); - - if (error) throw error; - - } catch (error: any) { - toast({ - title: "Error signing in", - description: error.message, - variant: "destructive", - }); - console.error(`Error signing in with ${provider}:`, error); - throw error; - } finally { - setLoading(false); - } - }; - const signOut = async () => { try { setLoading(true); @@ -184,7 +158,6 @@ export const AuthProvider = ({ children }: { children: ReactNode }) => { loading, signIn, signUp, - signInWithProvider, signOut, }} > diff --git a/src/pages/Auth.tsx b/src/pages/Auth.tsx index c5d64ba..a06961a 100644 --- a/src/pages/Auth.tsx +++ b/src/pages/Auth.tsx @@ -2,16 +2,15 @@ import { useState } from 'react'; import { Navigate } from 'react-router-dom'; import { useAuth } from '@/contexts/AuthContext'; -import { ShieldCheck, Mail, Lock, User, Github, Google, Microsoft } from 'lucide-react'; +import { ShieldCheck, Mail, Lock, User } from 'lucide-react'; import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; import { Label } from '@/components/ui/label'; import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from '@/components/ui/card'; import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'; -import { Separator } from '@/components/ui/separator'; const Auth = () => { - const { user, signIn, signUp, signInWithProvider, loading } = useAuth(); + const { user, signIn, signUp, loading } = useAuth(); const [email, setEmail] = useState(''); const [password, setPassword] = useState(''); const [fullName, setFullName] = useState(''); @@ -42,15 +41,6 @@ const Auth = () => { } }; - const handleSocialSignIn = async (provider: 'google' | 'github' | 'microsoft') => { - setAuthError(null); - try { - await signInWithProvider(provider); - } catch (error: any) { - setAuthError(error.message); - } - }; - return (
@@ -111,7 +101,7 @@ const Auth = () => {
{authError}
)} - + - -
-
- -
-
- - Or continue with - -
-
- -
- - - -
@@ -221,7 +173,7 @@ const Auth = () => {
{authError}
)} - + - -
-
- -
-
- - Or continue with - -
-
- -
- - - -