isAuthorized method

  1. @override
Future<bool> isAuthorized()
override

Provides information if the current instance of RestApiClient contains Authorization header

Implementation

@override
Future<bool> isAuthorized() async {
  final containsAuthorizationHeader =
      options.headers.containsKey(RestApiClientKeys.authorization);
  final containsJwtInStorage =
      await _storageRepository.contains(RestApiClientKeys.jwt);
  final containsRefreshTokenInStorage =
      await _storageRepository.contains(RestApiClientKeys.refreshToken);

  return containsAuthorizationHeader &&
      containsJwtInStorage &&
      containsRefreshTokenInStorage;
}