sp-dev-docs icon indicating copy to clipboard operation
sp-dev-docs copied to clipboard

AadTokenProvider or MSGraphClient not working when logged with multiple live accounts as a guest/external user

Open FlorianLabranche opened this issue 7 years ago • 12 comments

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

FlorianLabranche avatar May 03 '19 09:05 FlorianLabranche

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.

msft-github-bot avatar May 03 '19 09:05 msft-github-bot

@FlorianLabranche Two questions:

  1. Is the user an external or guest user?
  2. 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

ghost avatar May 03 '19 17:05 ghost

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

FlorianLabranche avatar May 06 '19 13:05 FlorianLabranche

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.

ghost avatar May 08 '19 16:05 ghost

hey @FlorianLabranche. can you please confirm Landi's question? Thanks!

lucabandMSFT avatar May 09 '19 18:05 lucabandMSFT

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.

FlorianLabranche avatar May 09 '19 20:05 FlorianLabranche

Hello @lahuey , Any updates on this issue ?

FlorianLabranche avatar Jul 04 '19 15:07 FlorianLabranche

@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.

ghost avatar Jul 16 '19 00:07 ghost

Has there been any movement on this? I just started seeing these same errors yesterday

cdspace avatar Aug 16 '19 21:08 cdspace

On my side, I don't get this error anymore.

FlorianLabranche avatar Aug 18 '19 19:08 FlorianLabranche

Reopenning a new issue since it's still not fixed.

FlorianLabranche avatar Sep 04 '19 08:09 FlorianLabranche

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

msft-github-bot avatar Jan 24 '20 12:01 msft-github-bot