SOLVED

Not able to fetch data from SharePoint Online List using Postman tool

Copper Contributor

Hi,

I followed the process to fetch the data from SP online list using Postman tool:

- Register a new app.

- Generate client id and secret.

- Grant permission

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

- Trust the app.

Now in Postman

- Generate access token =>https://accounts.accesscontrol.windows.net/MyTokenId/tokens/OAuth/2/

- add following properties in body section

grant_type:client_credentials
client_id:client_id@tenant_id
client_secret:client_secret
resource:00000003-0000-0ff1-ce00-000000000000/YourSharepointOnlineDomainName@tenant_id

- Generate access token. Received successfully.

- Pass this token as "Bearer accessToken".

But now I am facing issue as "{"error":"invalid_request","error_description":"Token type is not allowed."}".

Please guide me, what wrong I am doing here. This SP site is a developer account subscription.

3 Replies

Hi @Nj-SharePointDeveloper 

ACS and SharePoint "ClientID" and "Secret" authentication is kind of old.
You need to re-activate it on new tenants using PowerShell as a SharePoint Admin.

It looks like this if you use PnP-Powershell

Connect-PnPOnline https://<yourtenant>-admin.sharepoint.com -Interactive
Set-PnPTenant -DisableCustomAppAuthentication $false

 Then your Postman request will work.

But ACS  is the "old" method...
You should take a look at Azure AD Apps and the "Sites.Selected" permission. 

Best Regards,
Sven


Error after running above command  The resource principal named https:// was not found in the tenant named "....". This can happen if the application has not been installed by the administrator of the tenant. etc etc

best response confirmed by Nj-SharePointDeveloper (Copper Contributor)
Solution

Hi @Nj-SharePointDeveloper 

When exactly did you get that error?

 

  • After executing the Powershell command?
    • After the login using "Connect-PnPOnline"?
    • After executing the "Set-PnPTenant" command?
  • After acquiring the token? (From https://accounts.accesscontrol.windows.net)
  • After executing a SharePoint REST request?


If it occurs during the login using "Connect-PnPOnline" try to execute the following command once before

Register-PnPManagementShellAccess

That registers the PnP Powershell as an app in your tenant.

Best Regards,

Sven

1 best response

Accepted Solutions
best response confirmed by Nj-SharePointDeveloper (Copper Contributor)
Solution

Hi @Nj-SharePointDeveloper 

When exactly did you get that error?

 

  • After executing the Powershell command?
    • After the login using "Connect-PnPOnline"?
    • After executing the "Set-PnPTenant" command?
  • After acquiring the token? (From https://accounts.accesscontrol.windows.net)
  • After executing a SharePoint REST request?


If it occurs during the login using "Connect-PnPOnline" try to execute the following command once before

Register-PnPManagementShellAccess

That registers the PnP Powershell as an app in your tenant.

Best Regards,

Sven

View solution in original post