refreshToken static method

Future<TokenResponse?> refreshToken(
  1. String refreshToken, {
  2. String? redirectUrl,
  3. String? clientId,
  4. String? realm,
  5. String? authServerUrl,
})

Refreshes the token using the given refresh token. By default, does not update the session. DON'T CALL THIS: Unless you are manually handling session data

Implementation

static Future<TokenResponse?> refreshToken(String refreshToken,
    {String? redirectUrl,
    String? clientId,
    String? realm,
    String? authServerUrl}) async {
  if (!_checkFields(redirectUrl, clientId, realm, authServerUrl)) {
    return null;
  }

  _logger.debug("Trying to refresh token!");
  TokenResponse? result = await _appAuth.token(TokenRequest(
      _clientId!, _redirectUrl!,
      discoveryUrl: discoveryUrl,
      refreshToken: refreshToken,
      scopes: _scopes));

  if (result == null) {
    _logger.warning("Getting refresh token returned null!");
  }
  return result;
}