Skip to content
DocsTry Aspire
DocsTry

LogtoClientBuilder Methods

ClassMethods3 members
Provides methods to configure and add Logto client services to an application builder.
AddLogtoJwtBearer(AuthenticationBuilder, string, string, string, string?, Action<JwtBearerOptions>)Section titled AddLogtoJwtBearer(AuthenticationBuilder, string, string, string, string?, Action<JwtBearerOptions>)extensionAuthenticationBuilder
Configures and adds the Logto JSON Web Token (JWT) Bearer authentication to the specified authentication builder.
public static class LogtoClientBuilder
{
public static AuthenticationBuilder AddLogtoJwtBearer(
this AuthenticationBuilder builder,
string serviceName,
string appIdentification,
string authenticationScheme = "Bearer",
string? configurationSectionName = "Aspire:Logto:Client",
Action<JwtBearerOptions>? configureOptions = null)
{
// ...
}
}
builderAuthenticationBuilderThe authentication builder used to configure authentication services.
serviceNamestringThe name of the Logto service instance to be used for authentication.
appIdentificationstringA collection of application identifiers associated with the Logto service.
authenticationSchemestringoptional The authentication scheme identifier for the Logto JWT Bearer authentication. Defaults to "Bearer".
configurationSectionNamestring?optional The name of the configuration section that contains Logto client settings. Defaults to "Aspire:Logto:Client".
configureOptionsAction<JwtBearerOptions>optional A delegate to configure the options for JWT bearer authentication.
AuthenticationBuilder An updated Authentication.AuthenticationBuilder instance with the configured Logto JWT Bearer authentication.
ArgumentNullExceptionThrown when the builder or serviceName is null.
AddLogtoJwtBearer(AuthenticationBuilder, string, IEnumerable<string>, string, string?, Action<JwtBearerOptions>)Section titled AddLogtoJwtBearer(AuthenticationBuilder, string, IEnumerable<string>, string, string?, Action<JwtBearerOptions>)extensionAuthenticationBuilder
Configures and adds the Logto JSON Web Token (JWT) Bearer authentication for the specified application.
public static class LogtoClientBuilder
{
public static AuthenticationBuilder AddLogtoJwtBearer(
this AuthenticationBuilder builder,
string serviceName,
IEnumerable<string> appIdentification,
string authenticationScheme = "Bearer",
string? configurationSectionName = "Aspire:Logto:Client",
Action<JwtBearerOptions>? configureOptions = null)
{
// ...
}
}
builderAuthenticationBuilder The authentication builder used to configure the application's authentication services.
serviceNamestring The name of the service associated with Logto configuration.
appIdentificationIEnumerable<string> A collection of application identifiers (audiences) used to validate the JWT's audience claim.
authenticationSchemestringoptional The authentication scheme identifier for the Logto JWT Bearer authentication. Defaults to "Bearer".
configurationSectionNamestring?optional The name of the configuration section that contains Logto client settings. Defaults to "Aspire:Logto:Client".
configureOptionsAction<JwtBearerOptions>optional A delegate to configure additional JwtBearerOptions as needed for specific authentication behavior.
AuthenticationBuilder An updated Authentication.AuthenticationBuilder instance with the configured Logto JWT Bearer authentication.
ArgumentNullExceptionThrown when the builder is null.
InvalidOperationException Thrown when serviceName or appIdentification is missing or invalid.
AddLogtoOIDC(IHostApplicationBuilder, string?, string?, string, string, Action<LogtoOptions>, Action<OpenIdConnectOptions>)Section titled AddLogtoOIDC(IHostApplicationBuilder, string?, string?, string, string, Action<LogtoOptions>, Action<OpenIdConnectOptions>)extensionIServiceCollection
Configures and adds the Logto OpenID Connect (OIDC) authentication for the specified application's service collection.
public static class LogtoClientBuilder
{
public static IServiceCollection AddLogtoOIDC(
this IHostApplicationBuilder builder,
string? connectionName = null,
string? configurationSectionName = "Aspire:Logto:Client",
string authenticationScheme = "Logto",
string cookieScheme = "Logto.Cookie",
Action<LogtoOptions>? logtoOptions = null,
Action<OpenIdConnectOptions>? oidcOptions = null)
{
// ...
}
}
builderIHostApplicationBuilderThe application builder used to configure the application's services and pipeline.
connectionNamestring?optionalThe name of the connection configuration to be used. If null, a default connection is used.
configurationSectionNamestring?optional The name of the configuration section that contains Logto client settings. Defaults to "Aspire:Logto:Client".
authenticationSchemestringoptional The authentication scheme identifier for the Logto OIDC authentication. Defaults to "Logto".
cookieSchemestringoptional The cookie scheme name to be used with the Logto OIDC authentication. Defaults to "Logto.Cookie".
logtoOptionsAction<LogtoOptions>optional A delegate to configure Logto-specific options such as endpoint, application ID, or secret.
oidcOptionsAction<OpenIdConnectOptions>optional A delegate to configure OpenID Connect options for fine-tuning authentication behavior.
IServiceCollection An updated DependencyInjection.IServiceCollection instance with the configured Logto OIDC authentication.
ArgumentNullExceptionThrown when the builder is null.