Sharepoint Search API - No User or App Context found

Monika V 60 Reputation points

Hi Team,

Currently we are exploring Search API and for Authentication, we are using a Bearer token.

The problem comes when I attempt to hit the search API:


The API returns a "400 Bad Request" with this response:

User's image

I have attempted to modify the below permissions but still no luck.

https://[my domain]

User's image

User's image

This below article suggested we needed to have "FullControl" on the tenant, which we have done and its working fine now. I can able to get the result.

Is having "FullControl" at the tenant level the sole solution to address this problem?

A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
9,536 questions
{count} votes

Accepted answer
  1. ChengFeng - MSFT 5,005 Reputation points Microsoft Vendor

    Hi @Monika V

    Please try :

      <AppPermissionRequest Scope="http://sharepoint/search" Right="QueryAsUserIgnoreAppPrincipal" />

    This permission lets you query the search add-in based on the user's permissions. This means that search results will be returned based on the user's ACLs.User's

    User's image

    Here is a link for your reference:

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Best Regards

    Cheng Feng

2 additional answers

Sort by: Most helpful
  1. Monika V 60 Reputation points

    Hi Cheng,

    Thanks for your response.

    Currently, we are using client ID and client secret to connect SharePoint online from the Node.js application. So, we tried to grant the below permission by following steps.

    Step 1:



    We will see the below screen.

    User's image

    Step 2:

    On the "AppInv.aspx" page, We enter the Client ID and Select Lookup.



    Step 3: Configure Permission

    Under Permission Request XML, we specify the below xml configuration for the permission.


    <AppPermissionRequest Scope=http://sharepoint/search Right="QueryAsUserIgnoreAppPrincipal" />



    Step 4:

    After entering the Client ID and XML configuration, click the "Create” button. Next, Clicked the “Trust It” button to grant the specified elevated permissions.

    But this is not working for us.. Only after giving below XML then only its working.

    <AppPermissionRequests AllowAppOnlyPolicy="true">
      <AppPermissionRequest Scope="http://sharepoint/content/tenant" Right="FullControl" />

  2. Monika V 60 Reputation points

    Hi Team,

    Waiting for your response.

    0 comments No comments