microsoftgraph / microsoft-graph-toolkit

Authentication Providers and UI components for Microsoft Graph 🦒
https://docs.microsoft.com/graph/toolkit/overview
Other
964 stars 309 forks source link

MGT people picker component not calling users api #1666

Closed nirajparajuli closed 1 year ago

nirajparajuli commented 2 years ago

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.

github-actions[bot] commented 2 years ago

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.

ghost commented 2 years ago

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 🙌

sebastienlevert commented 2 years ago

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!

nirajparajuli commented 2 years ago

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
sebastienlevert commented 2 years ago

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!

nirajparajuli commented 2 years ago

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} />

sebastienlevert commented 2 years ago

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

nirajparajuli commented 2 years ago

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

image
gavinbarron commented 1 year ago

Closing this as it was resolved in #1784