File tree Expand file tree Collapse file tree
src/lib/features/auth/data Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -40,6 +40,30 @@ class AuthHelper {
4040 }
4141 }
4242
43+ Future <bool > loginWithGoogle () async {
44+ try {
45+ return await supabase.auth.signInWithOAuth (
46+ OAuthProvider .google,
47+ redirectTo: 'taskapp://login-callback' , // back to app
48+ );
49+ } on AuthException catch (e) {
50+ print ('Lỗi đăng nhập Google: ${e .message }' );
51+ return false ;
52+ }
53+ }
54+
55+ Future <bool > loginWithFacebook () async {
56+ try {
57+ return await supabase.auth.signInWithOAuth (
58+ OAuthProvider .facebook,
59+ redirectTo: 'taskapp://login-callback' , // back to app
60+ );
61+ } on AuthException catch (e) {
62+ print ('Lỗi đăng nhập Facebook: ${e .message }' );
63+ return false ;
64+ }
65+ }
66+
4367 Future <UserModel ?> register (String email, String password, String username) async {
4468 try {
4569 final timezoneObj = await FlutterTimezone .getLocalTimezone ();
@@ -106,4 +130,14 @@ class AuthHelper {
106130 rethrow ;
107131 }
108132 }
133+ }
134+
135+ // SignOut session
136+ Future <void > signOut () async {
137+ try {
138+ await supabase.auth.signOut ();
139+ } catch (e) {
140+ print ('Lỗi đăng xuất: $e ' );
141+ rethrow ;
142+ }
109143}
You can’t perform that action at this time.
0 commit comments