revokeToken method

Future<void> revokeToken({
  1. required AuthToken authToken,
  2. required RevokeTokenType revokeTokenType,
  3. String? clientSecret,
  4. CancelToken? cancelToken,
  5. Map<String, dynamic>? headers,
  6. Map<String, dynamic>? extra,
  7. bool validateStatus(
    1. int?
    )?,
  8. void onSendProgress(
    1. int,
    2. int
    )?,
  9. void onReceiveProgress(
    1. int,
    2. int
    )?,
})

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: revokeTokenType.map(
      refresh: authToken.refreshToken ?? '',
      access: authToken.accessToken,
    ),
    tokenTypeHint: authToken.tokenType,
  );

  await oAuthApi.revokeToken(
    revokeTokenRequest: revokeTokenRequest,
    cancelToken: cancelToken,
    headers: headers,
    extra: extra,
    validateStatus: validateStatus,
    onSendProgress: onSendProgress,
    onReceiveProgress: onReceiveProgress,
  );
}