addAuthorization method

  1. @override
Future<bool> addAuthorization({
  1. required String jwt,
  2. required String refreshToken,
})
override

Method that adds Authorization header and initializes mechanism for managing refresh token logic

Implementation

@override
Future<bool> addAuthorization(
    {required String jwt, required String refreshToken}) async {
  final result = await _storageRepository.set(RestApiClientKeys.jwt, jwt);
  _addOrUpdateHeader(
      key: RestApiClientKeys.authorization, value: 'Bearer $jwt');

  return result &&
      await _storageRepository.set(
          RestApiClientKeys.refreshToken, refreshToken);
}