tokenRevocation method
Revoke token Revoke a previously issued token.
Parameters:
token
- The token to be revoked.clientId
- The identifier for your client.clientSecret
- The secret associated with your client.cancelToken
- ACancelToken
that can be used to cancel the operationheaders
- Can be used to add additional headers to the requestextras
- Can be used to add flags to the requestvalidateStatus
- AValidateStatus
callback that can be used to determine request success based on the HTTP status of the responseonSendProgress
- AProgressCallback
that can be used to get the send progressonReceiveProgress
- AProgressCallback
that can be used to get the receive progress
Returns a Future
Throws DioException
if API call or serialization fails
Implementation
Future<Response<void>> tokenRevocation({
String? token,
String? clientId,
String? clientSecret,
CancelToken? cancelToken,
Map<String, dynamic>? headers,
Map<String, dynamic>? extra,
ValidateStatus? validateStatus,
ProgressCallback? onSendProgress,
ProgressCallback? onReceiveProgress,
}) async {
const path = r'/oauth2/revoke';
final options = Options(
method: r'POST',
headers: <String, dynamic>{...?headers},
extra: <String, dynamic>{
'secure': <Map<String, String>>[
{'type': 'http', 'scheme': 'bearer', 'name': 'kindeBearerAuth'},
],
...?extra,
},
contentType: 'application/x-www-form-urlencoded',
validateStatus: validateStatus,
);
dynamic bodyData;
try {
bodyData = <String, dynamic>{
if (token != null)
r'token': encodeQueryParameter(
_serializers,
token,
const FullType(String),
),
if (clientId != null)
r'client_id': encodeQueryParameter(
_serializers,
clientId,
const FullType(String),
),
if (clientSecret != null)
r'client_secret': encodeQueryParameter(
_serializers,
clientSecret,
const FullType(String),
),
};
} catch (error, stackTrace) {
throw DioException(
requestOptions: options.compose(_dio.options, path),
type: DioExceptionType.unknown,
error: error,
stackTrace: stackTrace,
);
}
final response = await _dio.request<Object>(
path,
data: bodyData,
options: options,
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
return response;
}