setTokenPair static method

Future setTokenPair({
  1. String? accessToken,
  2. String? refreshToken,
})

Implementation

static Future setTokenPair({
  String? accessToken,
  String? refreshToken,
}) async {
  if (accessToken?.isEmpty ?? true) {
    throw Exception("access token is empty");
  }
  if (refreshToken?.isEmpty ?? true) {
    throw Exception("refresh token is empty");
  }
  var response = await _heraClient
      .get(HeraRequest(authToken: AuthToken(userToken: accessToken)));
  _setCurrentUser(response.user);
  _setAccessToken(accessToken ?? "");
  _setRefreshToken(refreshToken ?? "");
  onAuthenticated();
}