6/27/1
This commit is contained in:
@@ -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');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user