logout method

FutureOr<void> logout({
  1. required Uri endSessionEndpoint,
  2. Map<String, String>? headers,
  3. Client? client,
  4. String? idTokenHint,
  5. String? logoutHint,
  6. String? clientId,
  7. String? postLogoutRedirectUri,
  8. String? state,
  9. String? uiLocales,
})

Performs OpenID connect RP-Initiated Logout according to specification See: https://openid.net/specs/openid-connect-rpinitiated-1_0.html#RPLogout

Implementation

FutureOr<void> logout({
  required Uri endSessionEndpoint,
  Map<String, String>? headers,
  http.Client? client,
  String? idTokenHint,
  String? logoutHint,
  String? clientId,
  String? postLogoutRedirectUri,
  String? state,
  String? uiLocales,
}) async {
  headers ??= <String, String>{};
  final body = <String, String>{
    if (idTokenHint != null) 'id_token_hint': idTokenHint,
    if (logoutHint != null) 'logout_hint': logoutHint,
    if (clientId != null) 'client_id': clientId,
    if (postLogoutRedirectUri != null)
      'post_logout_redirect_uri': postLogoutRedirectUri,
    if (state != null) 'state': state,
    if (uiLocales != null) 'ui_locales': uiLocales,
  };
  await http_util.post(
    endSessionEndpoint,
    headers: headers,
    body: body,
    client: client,
  );
}