signOut method
Implementation
Future<void> signOut() async {
// if (await kakao.AuthApi.instance.hasToken()) {
// // 카카오 로그인인 경우
// try {
// kakao.AccessTokenInfo tokenInfo =
// await kakao.UserApi.instance.accessTokenInfo();
// debugPrint('토큰 유효성 체크 성공 ${tokenInfo.id} ${tokenInfo.expiresIn}');
// try {
// // Firebase에서도 로그아웃
// await FirebaseAuth.instance.signOut();
// // Kakao에서도 로그아웃
// await kakao.UserApi.instance.logout();
// debugPrint('로그아웃 성공, SDK에서 토큰 삭제');
// } catch (error) {
// debugPrint('로그아웃 실패, SDK에서 토큰 삭제 $error');
// }
// } catch (error) {
// if (error is kakao.KakaoException && error.isInvalidTokenError()) {
// debugPrint('토큰 만료 $error');
// } else {
// debugPrint('토큰 정보 조회 실패 $error');
// }
// }
// } else {
// // 카카오 로그인이 아닌 경우
// await _firebaseAuthInstance.signOut();
// try {
// await GoogleSignIn().disconnect();
// debugPrint("Disconnected");
// GoogleSignIn().signOut();
// debugPrint("Signed Out");
// } on FirebaseAuthException catch (e) {
// throw Exception(e);
// } catch (error) {
// debugPrint("[[Error on Riverpod signOut]]: $error");
// }
// }
await _firebaseAuthInstance.signOut();
try {
await GoogleSignIn().disconnect();
debugPrint("Disconnected");
GoogleSignIn().signOut();
debugPrint("Signed Out");
} on FirebaseAuthException catch (e) {
throw Exception(e);
} catch (error, stackTrace) {
debugPrint("[[Error on Riverpod signOut]]: $error");
debugPrint("[[StackTrace on Riverpod signOut]]]: $stackTrace");
}
}