-
Notifications
You must be signed in to change notification settings - Fork 155
Description
Library version used
1.23.1
Java version
24.0.1
Scenario
PublicClient (AcquireTokenInteractive, AcquireTokenByUsernamePassword)
Is this a new or an existing app?
This is a new app or experiment
Issue description and reproduction steps
When configuring our e2e test we're using a PublicClientApplication with ROPC flow (target platform being MS Entra External ID), when trying to authenticate via email + password using UserNamePasswordParameters the call to acquireToken fails with the following exception:
java.util.concurrent.ExecutionException: com.microsoft.aad.msal4j.MsalServiceException: AADSTS90002: Tenant 'mydomain.test' not found. Check to make sure you have the correct tenant ID and are signing into the correct cloud. Check with your subscription administrator, this may happen if there are no active subscriptions for the tenant.
It seems to be trying to get the tenant from the email after the @, so if using customer@mydomain.test it tries to use mydomain.test as tenant (tenant is correctly specified in the AUTHORITY field), if I try to specify the tenant manually using UserNamePasswordParameters.builder(....).tenant("TENANT_HERE") it seems to be simply ignored.
The customer@mydomain.test is a Local Account created manually and Sign-in Identifiers is enabled and configured for both Email and UPN.
If instead using the email I use the UPN in the form of [ID]@[TENANT].onmicrosoft.com without changing anything else, the authentication succeeds without a problem
Relevant code snippets
PublicClientApplication pca = PublicClientApplication.builder(APP_ID)
.authority(AUTHORITY)
.build();
UserNamePasswordParameters parameters =
UserNamePasswordParameters.builder(
SCOPES,
username,
password.toCharArray())
.build();
pca.acquireToken(parameters).get();Expected behavior
Authentication comples without issue when using either emailAdress or UPN.
Identity provider
Microsoft Entra External ID
Regression
No response
Solution and workarounds
No response