refreshToken method
구글 토큰 갱신 (조용한 로그인)
UI 없이 기존 세션으로 로그인을 시도합니다.
Implementation
@override
Future<AuthResult> refreshToken() async {
try {
if (!_initialized) await initialize();
final account =
await GoogleSignIn.instance.attemptLightweightAuthentication();
if (account == null) {
final error = KAuthError.fromCode(ErrorCodes.tokenExpired);
return AuthResult.failure(
provider: AuthProvider.google,
errorMessage: error.message,
errorCode: error.code,
errorHint: '다시 로그인해주세요.',
);
}
return _buildResult(account);
} catch (e) {
final error = KAuthError.fromCode(
ErrorCodes.tokenExpired,
originalError: e,
);
return AuthResult.failure(
provider: AuthProvider.google,
errorMessage: kDebugMode ? '구글 토큰 갱신 실패: $e' : '구글 토큰 갱신 실패',
errorCode: error.code,
errorHint: error.hint,
);
}
}