Skip to content
Introducing the next era of Duende IdentityServer. Read our CEO’s announcement

OIDC Client Logging

OidcClient logs errors, warnings, and diagnostic information using Microsoft.Extensions.Logging.ILogger, the standard .NET logging library.

For log level definitions, environment guidance, and actionable next steps for each level, see the Logging Fundamentals guide.

OidcClient does not use the ASP.NET Core dependency injection container directly — instead, you configure it by setting the LoggerFactory property on OidcClientOptions. This gives you full control over logging in native app, mobile, and console scenarios.

Program.cs
using Duende.IdentityModel;
using Duende.IdentityModel.OidcClient;
var builder = Host.CreateApplicationBuilder(args);
builder.Services.AddSingleton(svc =>
{
var loggerFactory = svc.GetRequiredService<ILoggerFactory>();
var options = new OidcClientOptions
{
Authority = "https://demo.duendesoftware.com",
ClientId = "interactive.public",
Scope = "openid profile email offline_access",
RedirectUri = "app://localhost/",
PostLogoutRedirectUri = "app://localhost/",
LoggerFactory = loggerFactory
};
return new OidcClient(options);
});
var app = builder.Build();
var client = app.Services.GetService<OidcClient>();

You can use any logging framework that integrates with ILoggerFactory, such as Serilog.

OidcClient emits logs at Trace, Debug, Information, and Error levels. To control log output, set the Duende.IdentityModel.OidcClient namespace in your appsettings.json:

appsettings.json
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information",
"Duende.IdentityModel.OidcClient": "Error"
}
}
}

OidcClient emits structured log messages across several functional areas. Each message includes contextual parameters for effective filtering and troubleshooting.

LevelMessageDescription
TraceLoginAsyncBeginning the login method
InformationStarting authentication request.Login flow initiated
InformationAuthentication request success.Login completed successfully
TracePrepareLoginAsyncPreparing login state for manual flow
TraceCreateAuthorizeStateAsyncCreating PKCE and state parameters
DebugThe IdentityProvider contains a pushed authorization request endpoint. Automatically pushing authorization parameters. Use DisablePushedAuthorization to opt out.PAR endpoint detected and being used
ErrorFailed to push authorization parametersPAR request failed
TraceCreateAuthorizeUrlBuilding the authorization URL
TraceCreateAuthorizeParametersAssembling authorize request parameters
TraceAuthorizeAsyncStarting browser-based authorization
LevelMessageDescription
TraceProcessResponseAsyncBeginning response processing
InformationProcessing response.Handling authorization response
DebugAuthorize response: {Response}Raw authorization response data
TraceProcessCodeFlowResponseAsyncProcessing authorization code flow
TraceRedeemCodeAsyncExchanging code for tokens
TraceValidateTokenResponseValidating token endpoint response
Error{Error}Authorization or token response error
LevelMessageDescription
TraceEnsureProviderInformationChecking provider configuration
DebugSkipping refresh of discovery document.Reusing cached discovery document
DebugSuccessfully loaded discovery documentDiscovery document retrieved
DebugLoaded keyset from {JwksUri}JSON Web Key Set location
DebugKeyset contains the following kids: {Kids}Available signing key IDs
ErrorError loading discovery document: {ErrorType} - {Error}Discovery document retrieval failed
ErrorIssuer name is missing in provider informationInvalid provider configuration
ErrorAuthorize endpoint is missing in provider informationInvalid provider configuration
ErrorToken endpoint is missing in provider informationInvalid provider configuration
ErrorKey set is missing in provider informationInvalid provider configuration (when required)
LevelMessageDescription
TraceGetUserInfoAsyncStarting userinfo request
ErrorError contacting userinfo endpoint: {Error}Userinfo request failed
Errorsub claim is missing from userinfo endpointUserinfo response missing required claim
Errorsub claim from userinfo endpoint is different than sub claim from identity token.Subject mismatch between tokens
LevelMessageDescription
TraceRefreshTokenAsyncStarting token refresh
ErrorFailed on RefreshTokensAsync: {Error} - {Description}Automatic token refresh failed (RefreshTokenDelegatingHandler)
LevelMessageDescription
TraceCreateEndSessionUrlBuilding the end session URL
LevelMessageDescription
TraceProcessClaimsMerging claims from tokens and userinfo
DebugClaim: {Type}: {Value}Individual claim being processed
LevelMessageDescription
TraceEffective options:Followed by serialized OidcClientOptions