ManagementApiBuilder.domain() builds an invalid URL when the domain includes https:// or a trailing slash

Offen
#945 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

@RaphaelFakhri arbeitet bereits daran.

Seit 17.10.2026.

  • #946 von @RaphaelFakhri — offen

Bewertung

Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Anfängerfreundlichkeit
35/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Veraltet
Tech-Stack
java
Bereich
api

Rechercherichtung

Start with ManagementApiBuilder.domain(...) and compare its URL construction with AuthAPI.newBuilder(...). Verify how domains containing https:// or a trailing slash are normalized, then add regression coverage for both forms. Done means the Management API, token, and default audience URLs use the expected https:// host and /api/v2 path without duplicated schemes or slashes.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

Description

ManagementApi.builder().domain(...) always prepends https:// and appends /api/v2 to the value as given. If the domain already includes the scheme, or ends with a slash, the client is built with an invalid API URL, and the client credentials flow requests a token from an invalid URL with an invalid default audience.

AuthAPI.newBuilder(domain, ...) accepts both my-tenant.auth0.com and https://my-tenant.auth0.com, and so did ManagementAPI.newBuilder(domain, ...) in 2.x. Code that passes the same domain value to both clients, or that was migrated from 2.x, fails at request time.

Reproduction
ManagementApi mgmt = ManagementApi.builder()
        .domain("https://my-tenant.auth0.com")
        .clientCredentials("{CLIENT_ID}", "{CLIENT_SECRET}")
        .build();
mgmt.users().list();
domain(...) value Management API URL Token URL Default audience
https://my-tenant.auth0.com https://https://my-tenant.auth0.com/api/v2 https://https://my-tenant.auth0.com/oauth/token https://https://my-tenant.auth0.com/api/v2/
my-tenant.auth0.com/ https://my-tenant.auth0.com//api/v2 https://my-tenant.auth0.com/oauth/token https://my-tenant.auth0.com//api/v2/

In the first case, no request reaches the tenant. The second case requests a token for an audience that does not match the Management API identifier, and API calls go to a //api/v2 path.

Expected behavior

domain() accepts the domain with or without https:// and with or without a trailing slash, as AuthAPI does, and builds https://my-tenant.auth0.com/api/v2.

Environment
  • auth0-java 5.4.0 (main at 484f9bb)
  • Java 8
Vorherrschende Sprache
Java
Sterne
319
Forks
156
Ø Merge
20 Std. 46 Min.
Gemergte PRs (30 T.)
3

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus auth0/auth0-java

Alle Issues in auth0/auth0-java

Ähnliche Issues

Weitere Issues zu Java

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.