You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
publicstaticasyncTask<AuthenticationResult>AcquireTokenWithPromptAsync(stringresource,stringtenant){stringauthority=$"{ProductionAuthority}/{tenant}";string[]scopes={resource+".default"};stringclientId=Client;varapp=newPublicClientApplication(clientId:clientId,authority:authority,userTokenCache:TokenCacheHelper.GetUserCache());returnawaitapp.AcquireTokenAsync(scopes).ConfigureAwait(false);}publicstaticasyncTask<AuthenticationResult>AcquireTokenSilentAsync(stringresource,stringtenant,stringuserId){stringauthority=$"{ProductionAuthority}/{tenant}";string[]scopes={resource+".default"};stringclientId=Client;AuthenticationResultresult=null;varapp=newPublicClientApplication(clientId:clientId,authority:authority,userTokenCache:TokenCacheHelper.GetUserCache());varaccount=awaitapp.GetAccountAsync(userId).ConfigureAwait(false);result=awaitapp.AcquireTokenSilentAsync(scopes,account).ConfigureAwait(false);returnresult;}varauthResult=awaitAcquireTokenWithPromptAsync("https://management.azure.com","Common");// suppose the home tenantId for the user is foo and it is also part of another tenant with tenantId bar// this call works and get a token for foovarresult=awaitAcquireTokenSilentAsync("https://graph.microsoft.com/",foo,authResult.Account.HomeAccountId.Identifier).ConfigureAwait(false);// this one still gets a token for foovarresult=awaitAcquireTokenSilentAsync("https://graph.microsoft.com/",bar,authResult.Account.HomeAccountId.Identifier).ConfigureAwait(false);
Expected behavior
With AcquireTokenSilentAsync call for tenant bar we expect to get an AuthenticationResult for that tenant.
Actual behavior
Irrespective of the tenant requested we always get the token for the home tenant.
Uh oh!
There was an error while loading. Please reload this page.
name: Bug report
about: Cannot Acquire token for resources other than home tenant
Which Version of MSAL are you using ?
Note that to get help, you need to run the latest preview or non-preview version
For ADAL, please log issues to https://github.com/AzureAD/azure-activedirectory-library-for-dotnet
v2.5.0-preview
Which platform has the issue?
net45
What authentication flow has the issue?
Other? - please describe;
What is the identity provider ?
If B2C, what social identity did you use?
Repro
Expected behavior
With AcquireTokenSilentAsync call for tenant bar we expect to get an AuthenticationResult for that tenant.
Actual behavior
Irrespective of the tenant requested we always get the token for the home tenant.
Possible Solution
Additional context/ Logs / Screenshots
Add any other context about the problem here, such as logs and screebshots. Logging is described at https://github.com/AzureAD/microsoft-authentication-library-for-dotnet/wiki/logging
The text was updated successfully, but these errors were encountered: