logoutToken method

Future<void> logoutToken()

Implementation

Future<void> logoutToken() async {
  if (_autoRenewTimer != null) _autoRenewTimer = null;

  if (_identity == null) return;

  try {
    //Make sure we have the discovery information
    await _verifyDiscoveryDocument();

    await OpenIdConnect.logoutToken(
      request: LogoutTokenRequest(
        clientId: clientId,
        clientSecret: clientSecret,
        refreshToken: identity!.refreshToken!,
        configuration: configuration!,
      ),
    );
  } on Exception catch (e) {
    _raiseEvent(AuthEvent(AuthEventTypes.Error, message: e.toString()));
  }

  clearIdentity();
  _raiseEvent(AuthEvent(AuthEventTypes.NotLoggedIn));
}