submitSelfServiceLogoutFlow method

Future<Response<void>> submitSelfServiceLogoutFlow({
  1. String? token,
  2. String? returnTo,
  3. CancelToken? cancelToken,
  4. Map<String, dynamic>? headers,
  5. Map<String, dynamic>? extra,
  6. ValidateStatus? validateStatus,
  7. ProgressCallback? onSendProgress,
  8. ProgressCallback? onReceiveProgress,
})

Complete Self-Service Logout This endpoint logs out an identity in a self-service manner. If the `Accept` HTTP header is not set to `application/json`, the browser will be redirected (HTTP 302 Found) to the `return_to` parameter of the initial request or fall back to `urls.default_return_to`. If the `Accept` HTTP header is set to `application/json`, a 204 No Content response will be sent on successful logout instead. This endpoint is NOT INTENDED for API clients and only works with browsers (Chrome, Firefox, ...). For API clients you can call the `/self-service/logout/api` URL directly with the Ory Session Token. More information can be found at Ory Kratos User Logout Documentation.

Parameters:

  • token - A Valid Logout Token If you do not have a logout token because you only have a session cookie, call /self-service/logout/urls to generate a URL for this endpoint.
  • returnTo - The URL to return to after the logout was completed.
  • cancelToken - A CancelToken that can be used to cancel the operation
  • headers - Can be used to add additional headers to the request
  • extras - Can be used to add flags to the request
  • validateStatus - A ValidateStatus callback that can be used to determine request success based on the HTTP status of the response
  • onSendProgress - A ProgressCallback that can be used to get the send progress
  • onReceiveProgress - A ProgressCallback that can be used to get the receive progress

Returns a Future Throws DioError if API call or serialization fails

Implementation

Future<Response<void>> submitSelfServiceLogoutFlow({
  String? token,
  String? returnTo,
  CancelToken? cancelToken,
  Map<String, dynamic>? headers,
  Map<String, dynamic>? extra,
  ValidateStatus? validateStatus,
  ProgressCallback? onSendProgress,
  ProgressCallback? onReceiveProgress,
}) async {
  final _path = r'/self-service/logout';
  final _options = Options(
    method: r'GET',
    headers: <String, dynamic>{
      ...?headers,
    },
    extra: <String, dynamic>{
      'secure': <Map<String, String>>[],
      ...?extra,
    },
    validateStatus: validateStatus,
  );

  final _queryParameters = <String, dynamic>{
    if (token != null) r'token': encodeQueryParameter(_serializers, token, const FullType(String)),
    if (returnTo != null) r'return_to': encodeQueryParameter(_serializers, returnTo, const FullType(String)),
  };

  final _response = await _dio.request<Object>(
    _path,
    options: _options,
    queryParameters: _queryParameters,
    cancelToken: cancelToken,
    onSendProgress: onSendProgress,
    onReceiveProgress: onReceiveProgress,
  );

  return _response;
}