OAuth2EndpointOverrides
Optional per-endpoint URL overrides for an OAuth2Client.
When provided via OAuth2ClientBuilder.endpointOverrides, each non-null field replaces the corresponding URL that would otherwise be obtained from the OpenID Connect discovery document.
Skip-discovery optimization: When all 8 fields are non-null, the SDK skips the HTTP request to {issuerUrl}/.well-known/openid-configuration entirely and uses the override values directly. This is useful for environments where the discovery URL is unavailable or when startup latency must be minimized.
Partial overrides: When only some fields are non-null, the discovery document is still fetched. The override values then win over the discovered values for those specific fields.
All non-null values must be valid HTTPS URLs; validation occurs at OAuth2ClientBuilder build time.
Example — override only the token endpoint:
val client = OAuth2ClientBuilder.create(
issuerUrl = "https://your-okta-domain.okta.com/oauth2/default",
clientId = "client-id",
scope = listOf("openid"),
) {
endpointOverrides = OAuth2EndpointOverrides(
tokenEndpoint = "https://proxy.example.com/token"
)
}.getOrThrow()Parameters
override URL for the authorization endpoint, or null to use discovery.
override URL for the token endpoint, or null to use discovery.
override URL for the user-info endpoint, or null to use discovery.
override URL for the JWKS URI, or null to use discovery.
override URL for the introspection endpoint, or null to use discovery.
override URL for the revocation endpoint, or null to use discovery.
override URL for the end-session (logout) endpoint, or null to use discovery.
override URL for the device authorization endpoint, or null to use discovery.
override URL for the Pushed Authorization Request (PAR) endpoint, or null to use discovery. Not counted toward the skip-discovery optimization above — PAR is opt-in via OAuth2ClientBuilder.enablePushedAuthorizationRequests, so leaving this null never blocks skipping discovery for the other 8 fields. Set this when all-8-fields skip-discovery is used together with PAR, since discovery (the normal source of this endpoint) is bypassed.