Skip to content

AadHttpClient or MSGraphClient does not work with multiple live accounts #2629

@edijsf

Description

@edijsf

Category

  • Question
  • Typo
  • Bug
  • Additional article idea

Expected or Desired Behavior

When multiple accounts found user interaction for choosing correct account should be provided

Observed Behavior

When multiple live account logged in or when current service account does not match any live account you get error.

Steps to Reproduce

When you are logged in SharePoint where SFPX web part exists that connects to Azure services wither using AadHttpClient or MSGraphClient client and check it works fine. Then open in new browser tab Azure portal do sign-out and log in with different account and switch to SharePoint tab and refresh.
Or when multiple live accounts found you will get similar issue.

Following errors are not processed.
Error in case of multiple live accounts found:
AADSTS70002: Error validating credentials. AADSTS16000: Request is ambiguous: multiple user identities are available for the current request
Error in case of account mismatch
AADSTS50058: A silent sign-in request was sent but none of the currently signed in user(s) match the requested login hint

Proposed solution

Solution @microsoft/sp-http

// AdalAuthContext.js
67: AdalAuthContext.prototype._fetchAccessTokenSilent = function (resourceEndpoint) {`
.
.
73: if (_this._authContext._getItem(_this._authContext.CONSTANTS.STORAGE.ERROR) === 'interaction_required') {

Only one error is processed "interaction_required", but should process also when above mentioned errors are found.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:authCategory: Authentication (Azure AD / etc)status:answeredAnswer to a question.status:fixed-next-dropIssue planned to be fixed in an upcoming release.status:trackedCurrently tracked with Microsoft’s internal issue tracking system. DO NOT ADD/REMOVE (MSFT managed)type:bug-suspectedSuspected bug (not working as designed/expected). See “type:bug-confirmed” for confirmed bugs.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions