This commit is contained in:
Hamza-Ayed
2024-06-27 17:41:40 +03:00
parent ce2dfa2ff4
commit 929ecf39f9
26 changed files with 461 additions and 274 deletions

View File

@@ -7,28 +7,40 @@ class AuthController extends GetxController {
Future<User?> signInWithApple() async {
try {
print('Starting Apple Sign In process');
final appleCredential = await SignInWithApple.getAppleIDCredential(
scopes: [
AppleIDAuthorizationScopes.email,
AppleIDAuthorizationScopes.fullName,
],
);
print('Apple ID Credential obtained');
final oAuthProvider = OAuthProvider('apple.com');
final credential = oAuthProvider.credential(
idToken: appleCredential.identityToken,
accessToken: appleCredential.authorizationCode,
);
print('OAuth credential created');
UserCredential userCredential =
await _auth.signInWithCredential(credential);
print('User signed in successfully: ${userCredential.user?.uid}');
return userCredential.user;
} catch (error) {
print('Error during Apple Sign In: $error');
return null;
}
}
void signOut() async {
await _auth.signOut();
Future<void> signOut() async {
try {
await _auth.signOut();
print('User signed out successfully');
} catch (error) {
print('Error during sign out: $error');
}
}
}