Skip to content

[Auth][OIDC] OpenID/OIDC to support logout with id_token_hint #2716

Description

@digger73

What would you like to be added:

Add possibility of using the IdToken when logging out using the OIDC.

Why is this needed:

Currently when using UseAuthentication with AddOidc call with a redirect URL you can experience that logout isn't possible towards some services. This is for example the case with keycloak. Where it requires a id_token_hint when logging out. This is also recommended in the openid specification openidSpec.
Furthermore, it is supported in the IdentityModel API that UNO is wrapping. Implementation wise in the:
src/Uno.Extensions.Authentication.Oidc/OidcAuthenticationProvider.cs

protected async override ValueTask<bool> InternalLogoutAsync(IDispatcher? dispatcher, CancellationToken cancellationToken)
	{
		if (_client is null)
		{
			return true;
		}

		await _client.LogoutAsync();
		return true;
	}

To support this, it requires to add the LogOutRequest in the await _client.LogoutAsync() in above method (line 75 in OidcAuthenticationProvider.cs),and set the IdTokenHint = creds[TokenCacheExtensions.IdTokenKey] for the LogOutRequest. The LogOutRequest is an optional parameter in OidcClient, public virtual async Task<LogoutResult> LogoutAsync(LogoutRequest request = null, CancellationToken cancellationToken = default).
This could be an optional / configurable decision to not break backwards compatibility.

For which Platform:

  • [ x] iOS
  • [ x] Android
  • [ x] WebAssembly
  • [ x] WebAssembly renders for Xamarin.Forms
  • [ x] Windows
  • Build tasks

Anything else we need to know?

Activity

  1. added
    kind/enhancement
    triage/untriaged
    on Mar 14, 2025
  2. removed
    kind/enhancement
    on Nov 25, 2025
  3. added theissue type on Nov 25, 2025
  4. removed
    triage/untriaged
    on Nov 25, 2025
  5. changed the title [-]OpenID/OIDC to support logout with id_token_hint[/-] [+][Auth][OIDC] OpenID/OIDC to support logout with id_token_hint[/+] on Nov 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions