cacheTokens method

Future<void> cacheTokens()

This is used to save the session tokens to local storage

Implementation

Future<void> cacheTokens() async {
  final idTokenKey = '$keyPrefix.idToken';
  final accessTokenKey = '$keyPrefix.accessToken';
  final refreshTokenKey = '$keyPrefix.refreshToken';
  final clockDriftKey = '$keyPrefix.clockDrift';

  await Future.wait([
    storage.setItem(
        idTokenKey, _signInUserSession?.getIdToken().getJwtToken()),
    storage.setItem(
        accessTokenKey, _signInUserSession?.getAccessToken().getJwtToken()),
    storage.setItem(
        refreshTokenKey, _signInUserSession?.getRefreshToken()?.getToken()),
    storage.setItem(clockDriftKey, '${_signInUserSession?.getClockDrift()}'),
    storage.setItem(pool.lastUserKey, username),
  ]);
}