microsoft-graph-toolkit icon indicating copy to clipboard operation
microsoft-graph-toolkit copied to clipboard

MGT people picker component not calling users api

Open nirajparajuli opened this issue 2 years ago • 8 comments

Latest version of mgt people picker component is not searching all users in the tenant. Upon further review i found that the component is only calling me/people api and never calls the users api.

Peoplepicker component version: MGT-PEOPLE-PICKER/2.4.0, MgtMsalProvider/2.4.0, mgt/2.4.0, graph-js/2.2.1 (featureUsage=6)


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

nirajparajuli avatar Apr 20 '22 21:04 nirajparajuli

This issue has been assigned to you, @angelgolfer-ms. You are listed as the author for the document associated with this issue. If this is not correct, please take the following actions.

  • Assign this issue to the correct author
  • Create a pull request to update the author field in the YAML front-matter of this topic

github-actions[bot] avatar Apr 20 '22 21:04 github-actions[bot]

Hello nirajparajuli, thank you for opening an issue with us!

I have automatically added a "needs triage" label to help get things started. Our team will analyze and investigate the issue, and escalate it to the relevant team if possible. Other community members may also look into the issue and provide feedback 🙌

ghost avatar May 09 '22 17:05 ghost

Hello @nirajparajuli!

I just transfered the issue from the Docs repo to our MGT repo!

It seems related to #1665 and would be a configuration issue. Depending on the permissions you have provided, not all endpoints are used. Can you share the example of code you are using and the permissions granted on your Azure AD Application? Thanks!

sebastienlevert avatar May 09 '22 17:05 sebastienlevert

Thanks for looking into this issue. Here is how MSAL Auth is configured:

export const msalConfig = { clientId: process.env.REACT_APP_MSAL_CLIENT_ID, authority: "https://login.microsoftonline.com/" + process.env.REACT_APP_MSAL_TENANT_ID, scopes: [process.env.REACT_APP_MSAL_SCOPE + "/user_impersonation"], };

import { Providers, ProviderState } from "@microsoft/mgt-element"; import { MsalProvider } from "@microsoft/mgt-msal-provider"; Providers.globalProvider = new MsalProvider(msalConfig);

Here is the permissions granted to the AAD app : image

nirajparajuli avatar May 09 '22 19:05 nirajparajuli

When using the component, do you get any 404 or 403?

Also, I highly advise to get on the Msal2Provider as it provides more secure capabilities. MSAL v1 is now in maintenance mode.

If you can share a sample of the code with your mgt code (including the html you are using) it would also be great!

sebastienlevert avatar May 09 '22 19:05 sebastienlevert

There is no error, searching for a user will only call me/people api but will not call the /users api. Here is how the mgt people picker component is being used:

import { PeoplePicker } from "@microsoft/mgt-react";

<PeoplePicker placeholder="Start typing user name" selectionChanged={handleUserSelectionChanged} />

nirajparajuli avatar May 09 '22 19:05 nirajparajuli

Can you share how the component is used in your React code? What are the properties / attributes used on the PeoplePicker in the code?

sebastienlevert avatar May 09 '22 21:05 sebastienlevert

Not sure why the code is not showing in the comment box. here is a screenshot.

image

nirajparajuli avatar May 09 '22 21:05 nirajparajuli

Closing this as it was resolved in #1784

gavinbarron avatar Jan 31 '23 19:01 gavinbarron