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

Ouverte
#945 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

@RaphaelFakhri y travaille déjà.

Depuis le 17/10/2026.

  • #946 par @RaphaelFakhri — ouverte

Évaluation

Difficulté
2/5
Temps estimé
1-3 heures
Accessibilité débutants
35/100
Type d'issue
Bug
Clarté
Clairement spécifiée
Activité
À l'abandon
Stack technique
java
Domaine
api

Piste de recherche

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.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

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
Langage dominant
Java
Étoiles
319
Forks
156
Merge moyen
20 h 46 min
PR mergées (30 j)
3

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de auth0/auth0-java

Toutes les issues de auth0/auth0-java

Issues similaires

Plus d'issues Java

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.