revokeToken method
Revoke an AuthToken refreshToken or accessToken depending on
the revokeTokenType
for an user and a clientId
clientSecret is necessary only if your client's authorization method is POST
See the ReachFive doc for Revoke token endpoint
Implementation
Future<void> revokeToken({
required AuthToken authToken,
required RevokeTokenType revokeTokenType,
String? clientSecret,
CancelToken? cancelToken,
Map<String, dynamic>? headers,
Map<String, dynamic>? extra,
bool Function(int?)? validateStatus,
void Function(int, int)? onSendProgress,
void Function(int, int)? onReceiveProgress,
}) async {
final revokeTokenRequest = RevokeTokenRequest(
clientId: reachFiveKey.sdkConfig.clientId,
clientSecret: clientSecret ?? '',
token: switch (revokeTokenType) {
RevokeTokenType.refresh => authToken.refreshToken ?? '',
RevokeTokenType.access => authToken.accessToken,
},
tokenTypeHint: authToken.tokenType,
);
await oAuthApi.revokeToken(
revokeTokenRequest: revokeTokenRequest,
cancelToken: cancelToken,
headers: headers,
extra: extra,
validateStatus: validateStatus,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
}