TsgcHTTP_OAuth2_ClientMethods › Revoke

Revoke Method

Revokes an access or refresh token per RFC 7009.

Syntax

procedure Revoke(const aToken: String; const aTokenTypeHint: String = '');

Parameters

NameTypeDescription
aTokenconst StringThe access or refresh token to invalidate at the authorization server.
aTokenTypeHintconst StringOptional hint about the token type, typically 'access_token' or 'refresh_token'. Defaults to an empty string, which lets the server infer the type.

Remarks

Sends a POST request to AuthorizationServerOptions.RevocationURL as defined in RFC 7009, asking the authorization server to invalidate the supplied token. Requires AuthorizationServerOptions.RevocationURL to be set. The OnBeforeRevokeToken, OnAfterRevokeToken and OnErrorRevokeToken events are raised during the operation.

Example

// Revoke the current access token
OAuth2Client.Revoke(OAuth2Client.AccessToken, 'access_token');
// Revoke a refresh token
OAuth2Client.Revoke(OAuth2Client.CurrentRefreshToken, 'refresh_token');
// Revoke without specifying the token type hint
OAuth2Client.Revoke(OAuth2Client.AccessToken);

Back to Methods