Skip to content

People Search REST API 401 Response #10246

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
1 of 9 tasks
kristen-argent opened this issue May 8, 2025 · 14 comments
Open
1 of 9 tasks

People Search REST API 401 Response #10246

kristen-argent opened this issue May 8, 2025 · 14 comments
Assignees
Labels
area:search sharepoint-developer-support sharepoint-developer-support status:fixed Issue was fixed in current or prior release. type:bug-confirmed Confirmed bug, not working as designed / expected. type:bug-suspected Suspected bug (not working as designed/expected). See “type:bug-confirmed” for confirmed bugs.

Comments

@kristen-argent
Copy link

Target SharePoint environment

SharePoint Online

What SharePoint development model, framework, SDK or API is this about?

SharePoint REST API

Developer environment

Windows

What browser(s) / client(s) have you tested

  • 💥 Internet Explorer
  • 💥 Microsoft Edge
  • 💥 Google Chrome
  • 💥 FireFox
  • 💥 Safari
  • mobile (iOS/iPadOS)
  • mobile (Android)
  • not applicable
  • other (enter in the "Additional environment details" area below)

Additional environment details

Hitting the API in any way

Describe the bug / error

We have developed an application that makes use of the rest search API - until Tuesday this was working well in all environments.

Since then it has ceased working in some environments (Australian) and is now returning a 401 Unauthorized response.
It continues to work in two of our tenants (US based)

We use sourceId=B09A7990-05EA-4AF9-81EF-EDFAB16C4E31.

The query is being run by the application entra id, not using a user token.
Hitting search api without the source id filter also works correctly.

Steps to reproduce

Request URL with app token.

https://___.sharepoint.com/_api/search/query?querytext=%27user%27&sourceid=%27b09a7990-05ea-4af9-81ef-edfab16c4e31%i27

Expected behavior

Search results returned

@kristen-argent kristen-argent added the type:bug-suspected Suspected bug (not working as designed/expected). See “type:bug-confirmed” for confirmed bugs. label May 8, 2025
@Ashlesha-MSFT
Copy link

Hello @kristen-argent,
Thank you for bringing this issue to our attention. We will look into it and get back to you shortly.

@Ashlesha-MSFT Ashlesha-MSFT self-assigned this May 8, 2025
@Ashlesha-MSFT Ashlesha-MSFT added the sharepoint-developer-support sharepoint-developer-support label May 8, 2025
@Ashlesha-MSFT
Copy link

@kristen-argent,

We were unable to reproduce the issue in our tenant. To assist further, could you please share the tenant details? This will help us escalate and investigate the matter more effectively with our engineering team.

Image

@kristen-argent
Copy link
Author

@Ashlesha-MSFT

The tenant with issues:

Image

The tenant still working:

Image

@Ashlesha-MSFT Ashlesha-MSFT added the type:bug-confirmed Confirmed bug, not working as designed / expected. label May 9, 2025
@kristen-argent
Copy link
Author

@Ashlesha-MSFT any update on this issue? Looks like you have been able to reproduce after the tenant information was provided? Are we likely to see a fix soon?

@Ashlesha-MSFT
Copy link

@kristen-argent,
We’ve logged this issue as a bug already, and our engineering team is currently investigating it.
They’re working on a fix and it should be addressed soon.

@MortenPedersenDK
Copy link

Not sure if it is related, but in some tenants I get 401 Unauthorized when calling the Search REST API like below, while in other tenants I do not.

https://tenant.sharepoint.com/sites/intranet/_api/search/query?querytext=%27DepartmentId:98459155-b50b-431b-968c-b6d9aedeeb65%20contentclass:STS_Site%27&selectproperties=%27Path,ContentClass,SiteId%27

I have checked the App registration in entra, and they are 100% identical.

I use HttpClient for the call, using Bearer token like this:

var url = baseUrl + $"/_api/search/query?querytext=%27DepartmentId:{hubId.ToString()}%20contentclass:STS_Site%27&selectproperties=%27Path,ContentClass,SiteId%27";
var req = new HttpRequestMessage(HttpMethod.Get, url);
var token = ctx.GetAccessToken();
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", token);
HttpClient http = new HttpClient();
http.DefaultRequestHeaders.Accept.Clear();
http.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

var response = await http.SendAsync(req);
string json = await response.Content.ReadAsStringAsync();

On the failing tenants I get this response:

{"odata.error":{"code":"-1, Microsoft.Office.Server.Search.REST.SearchServiceException","message":{"lang":"da-DK","value":"Uautoriseret."}}}

@VesaJuvonen
Copy link
Contributor

This was an issue on the Microsoft yesterday, which was also logged at the tenant status updates. Issue has been resolved. You can find a b it more details on the following GitHub issue where this was also discussed in the context of PnP search web parts - microsoft-search/pnp-modern-search#4361.

Closing as resolved.

@VesaJuvonen VesaJuvonen added status:fixed Issue was fixed in current or prior release. area:search labels May 14, 2025
@kristen-argent
Copy link
Author

kristen-argent commented May 14, 2025

@VesaJuvonen with all due respect this issue was completely different from the issue yesterday and is still occurring. I would like this issue re opened as I believe there is a fix being developed as per @Ashlesha-MSFT.
The fact that this issue was closed without even verification from my side is completely ridiculous.
If it’s not reopened I’ll be raising another bug shortly.

@SaschaHenning
Copy link

Hi - same here... Error still occurs.

We have an app which has all necessary access. The Submit-PnPSearchQuery for the SourceId "b09a7990-05ea-4af9-81ef-edfab16c4e31" (People) returns an access error. It works fine with other Sources (or without a SourceId using the default one)

Image

This stopped working last week.

@MortenPedersenDK
Copy link

Still unsure whether related, but @VesaJuvonen I still get same error as mentioned above.

@kristen-argent
Copy link
Author

Will comment on both these tickets but all of our tenants are now impacted by this issue.

@SReid01
Copy link

SReid01 commented May 16, 2025

have exact same issue. I also have a ticket in as well.

@f0oster
Copy link

f0oster commented May 19, 2025

As per my note in #10261 - also still experiencing the same issue querying SourceId b09a7990-05ea-4af9-81ef-edfab16c4e31.

@VesaJuvonen I think this should be reopened?

@VesaJuvonen
Copy link
Contributor

Reopening based on comments. Hopefully gets also routed with other channels to the support pipeline.

@VesaJuvonen VesaJuvonen reopened this Jun 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:search sharepoint-developer-support sharepoint-developer-support status:fixed Issue was fixed in current or prior release. type:bug-confirmed Confirmed bug, not working as designed / expected. type:bug-suspected Suspected bug (not working as designed/expected). See “type:bug-confirmed” for confirmed bugs.
Projects
None yet
Development

No branches or pull requests

7 participants