How to use the @openid/appauth.RevokeTokenRequest function in @openid/appauth

To help you get started, we’ve selected a few @openid/appauth examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github imodeljs / imodeljs / core / clients-backend / src / oidc / OidcDeviceClient.ts View on Github external
private async makeRevokeTokenRequest(requestContext: ClientRequestContext): Promise {
    requestContext.enter();
    if (!this._configuration)
      throw new BentleyError(AuthStatus.Error, "Not initialized. First call initialize()", Logger.logError, loggerCategory);
    if (!this._tokenResponse)
      throw new BentleyError(AuthStatus.Error, "Missing refresh token. First call signIn() and ensure it's successful", Logger.logError, loggerCategory);

    const request = new RevokeTokenRequest({ token: this._tokenResponse.refreshToken! });
    await this._tokenHandler.performRevokeTokenRequest(this._configuration, request);
    requestContext.enter();

    this._tokenResponse = undefined;
    Logger.logTrace(loggerCategory, "Authorization revoked, and removed access token");
    this.onUserStateChanged.raiseEvent(undefined);
  }
}