refreshToken method

  1. @override
Future<AuthResult> refreshToken()
override

구글 토큰 갱신 (조용한 로그인)

UI 없이 기존 세션으로 로그인을 시도합니다.

Implementation

@override
Future<AuthResult> refreshToken() async {
  try {
    if (!_initialized) await initialize();

    final account =
        await GoogleSignIn.instance.attemptLightweightAuthentication();

    if (account == null) {
      return ErrorMapper.toFailure(
        AuthProvider.google,
        KAuthError.fromCode(ErrorCodes.tokenExpired),
      );
    }

    return _buildResult(account);
  } catch (e) {
    return ErrorMapper.handleException(
      AuthProvider.google,
      e,
      operation: '토큰 갱신',
      errorCode: ErrorCodes.refreshFailed,
    );
  }
}