AadTokenProvider or MSGraphClient not working when logged with multiple live accounts as a guest/external user
Category
- [ ] Question
- [ ] Typo
- [x] Bug
- [ ] Additional article idea
Expected or Desired Behavior
Correct account should be chosen whan logged in with multiple accounts.
Observed Behavior
When you're logged in with multiple accounts and you try to fetch token with AadTokenProvider or connect with MSGraphClient, you get an error.
Steps to Reproduce
When logged in to SharePoint with multiple accounts, SPFx webparts and extension that are using either AadTokenProvider or MSGraphClient are throwing the below error:
"AADSTS16000: Either multiple user identities are available for the current request or selected account is not supported for the scenario.
Related issue: #2629
Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.
@FlorianLabranche Two questions:
- Is the user an external or guest user?
- Could you share the url of the request to retrieve tokens (with guids/personal info redacted)? The url should look like this -> https://login.microsoftonline.com/common/oauth2/authorize?response_type=token&client_id={}&resource=https%3A%2F%2Fgraph.microsoft.com&redirect_uri=https%3A%2F%2Fwebshell.suite.office.com%2Fiframe%2FTokenFactoryIframe&state=f0d8e53d-77f2-438a-bcf4-4abd34d08393%7Chttps%3A%2F%2Fgraph.microsoft.com&client-request-id={}&x-client-SKU=Js&x-client-Ver=1.0.15&prompt=none&login_hint=UPN&domain_hint=microsoft.com
Hi @lahuey ,
I'm logged in with an internal account and a guest account.
Here's the URL for graph (using context.msGraphClientFactory): https://login.microsoftonline.com/{tenantId}/oauth2/authorize?response_type=token&client_id={}&resource=https%3A%2F%2Fgraph.microsoft.com&redirect_uri=https%3A%2F%2F{tenantName}.sharepoint.com%2F_forms%2Fspfxsinglesignon.aspx&state=b2886c50-b6c7-4b32-838e-939002851dc1%7Chttps%3A%2F%2Fgraph.microsoft.com&&client-request-id=affcf379-9543-4b9c-99c0-60936169889c&x-client-SKU=Js&x-client-Ver=1.0.16&prompt=none
And for a custom API (using context.aadTokenProviderFactory): https://login.microsoftonline.com/{tenantId}/oauth2/authorize?response_type=token&client_id={}&resource={appId}&redirect_uri=https%3A%2F%2F{tenantName}.sharepoint.com%2F_forms%2Fspfxsinglesignon.aspx&state=db0b1c1e-b082-4a39-a4da-1bf6a74c07ea%7C96e82d05-1876-4385-aa0a-b81bfce07422&&client-request-id=9752a4f0-f662-41ce-ae2c-373f67fc43dd&x-client-SKU=Js&x-client-Ver=1.0.16&prompt=none
Okay. I'm guessing both requests were made with the guest account right? There's a known issue with providing a login hint for guest/external users right now and we're working on finding the solution right now. I'll update this bug when we check in a fix.
I've also updated the bug title to reflect the actual issue.
hey @FlorianLabranche. can you please confirm Landi's question? Thanks!
Right. To be more accurate, it happens when I'm logged in with multiple account at the same time and the selected one (when prompted for on SharePoint opening) is the guest account.
Hello @lahuey , Any updates on this issue ?
@FlorianLabranche sorry about the delay. We need to reach out to the Azure AD team to help us with this issue. I will provide another update as soon as I have it.
Has there been any movement on this? I just started seeing these same errors yesterday
On my side, I don't get this error anymore.
Reopenning a new issue since it's still not fixed.
Issues that have been closed & had no follow-up activity for at least 7 days are automatically locked. Please refer to our wiki for more details, including how to remediate this action if you feel this was done prematurely or in error: Issue List: Our approach to locked issues