26 lines
794 B
Dart
26 lines
794 B
Dart
|
|
import 'package:regroup/Login/ViewModel/LoginApi.dart';
|
|
import 'package:regroup/Utils/Common/googleOAuthService.dart';
|
|
import 'package:sign_in_with_apple/sign_in_with_apple.dart';
|
|
|
|
class AppleOAuthService {
|
|
void logIn() async {
|
|
try {
|
|
final credential = await SignInWithApple.getAppleIDCredential(
|
|
scopes: [
|
|
AppleIDAuthorizationScopes.email,
|
|
AppleIDAuthorizationScopes.fullName,
|
|
],
|
|
);
|
|
logger.d("email is ${credential.email}");
|
|
logger.d("fullname is ${credential.givenName}");
|
|
logger.d("token is ${credential.userIdentifier}");
|
|
|
|
await LoginAPI()
|
|
.storeAppleSignin({"apple_auth_token": credential.userIdentifier}, emailReceived:credential.email );
|
|
} catch (e) {
|
|
print("Error occured");
|
|
}
|
|
}
|
|
}
|