revokeOAuthToken method
Future<void>
revokeOAuthToken(
- McpOAuthTokenGrant grant, {
- required McpOAuthClientAuthentication clientAuthentication,
- McpOAuthTokenKind tokenKind = McpOAuthTokenKind.refreshToken,
- Map<
String, String> headers = const <String, String>{}, - Duration timeout = const Duration(seconds: 30),
- int maxResponseBytes = 64 * 1024,
Revokes one OAuth grant credential without changing MCP session state.
Implementation
Future<void> revokeOAuthToken(
McpOAuthTokenGrant grant, {
required McpOAuthClientAuthentication clientAuthentication,
McpOAuthTokenKind tokenKind = McpOAuthTokenKind.refreshToken,
Map<String, String> headers = const <String, String>{},
Duration timeout = const Duration(seconds: 30),
int maxResponseBytes = 64 * 1024,
}) {
_throwIfClosed();
if (!grant.isForResource(endpoint)) {
throw McpOAuthTokenException(
'OAuth token grant is not valid for this MCP resource.',
endpoint: endpoint,
);
}
return _runTrackedOAuthHttpOperation(
(onRequestOpened) => revokeMcpOAuthToken(
grant,
clientAuthentication: clientAuthentication,
tokenKind: tokenKind,
httpClient: _httpClient,
headers: headers,
timeout: timeout,
maxResponseBytes: maxResponseBytes,
onRequestOpened: onRequestOpened,
),
);
}