-
Notifications
You must be signed in to change notification settings - Fork 345
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug] AADSTS50020 error if signing out then into another tenant without restarting the app #1365
Comments
I do not understand the repro steps, please clarify. You have a user e.g. john@companyA.com that is member of 2 tenants - companyA and companyB (home tenant companyA and guest tenant companyB). How does the user login to "companyA" and to "companyB"? |
Separate users in separate tenants. For example, using the provided app, log in with your work (@microsoft.com) account. Then log out and try to log in using any private/home Microsoft Account or an account on any other tenant (such as a demo tenant). |
Can repro. |
Can repro on other platforms, not just UWP. |
Workaround: re-create the public client application before each request i.e.
This is a bug where we update the authority with the tenant ID in AcquireTokenSilent. The same authority (tenanted to companyA) is then re-used to issue a request for a token for a user in companyB. |
I can confirm that the workaround indeed works :) |
FYI, I hit this same problem, looking forward to a release with the fix and will share results once I get to try it out. Glad this issue was filed as I had been spending time trying to debug -- I assumed it was my fault as I was in the process of migrating from the older MSAL with explicit caches to the new builder model with implicit cache. |
Yes, I updated shortly after it was released and everything works now :). I was able to incorporate it into a release (was originally planning on just relnoting the bug). Thanks very much for the quick turnaround on diagnosis, fix, and release. |
Thanks for the update @adamedx. Much appreciated! |
Which Version of MSAL are you using ?
MSAL 4.3.1
Platform
all
What authentication flow has the issue?
Description
In UWP apps (possibly also in non-UWP), if you execute the following sequence, an AADSTS50020 is issued:
AcquireTokenInteractive()
[user logs in successfully to CompanyA.com]AcquireTokenSilent()
[this is required for the bug to appear]AcquireTokenInteractive()
[user tries to login into CompanyB.com]The user should be able to log into CompanyB, however we get this error:
Logout looks like this:
Additional Information
.WithAuthority(AadAuthorityAudience.AzureAdMultipleOrgs)
to the app builder does not resolve the problem.I have provided a sample app to demonstrate this problem. You must supply your own AppId.
The text was updated successfully, but these errors were encountered: