0

I have been struggling to call SharePoint Rest API from Postman. The site is using ADFS Authentication & registered on ADFS using URN.

By following multiple Articles, I first Registered an App in SharePoint using Appreg.aspx page where I got the Client ID: 2526bc7a-2e0e-4d92-a5ac-69707ac7aeb2 & a Secret also.

I have granted permissions to this App:

Appinv permissions:

https://facilitiesuat.engro.com/_layouts/15/AppInv.aspx
<AppPermissionRequests AllowAppOnlyPolicy="true">
  <AppPermissionRequest Scope="http://sharepoint/content/sitecollection/web" Right="FullControl"/>
</AppPermissionRequests>

Then I used this Client ID to register this App for API call on ADFS server by following the below steps:

Steps to Register Client ID in ADFS via GUI (Graphical User Interface) Since you want to register the client without using PowerShell, follow these GUI-based steps to register a client application in ADFS. Step 2: Add a New Client Application

  1. In the left panel, expand AD FS → Application Groups.
  2. Right-click on Application Groups and select Add Application Group.
  3. In the Add Application Group Wizard: o Name: Enter a name (e.g., "Facilities API Client"). o Template: Select Server application accessing a web API. o Click Next. Step 3: Configure the Client ID
  4. Client Identifier: o Click Add and enter the Client ID you got from SharePoint. o Click Next.
  5. Redirect URI: o Click Add and enter: https://facilitiesuat.engro.com/_layouts/15/OAuthAuthorize.aspx o Click Next. Step 4: Configure Application Permissions
  6. Select Access Control Policy: Choose Permit everyone
  7. Web API: o In "Configure Web API", click Add. o Enter the resource identifier as: https://facilitiesuat.engro.com o Click Next. Step 5: Generate Client Secret
  8. On the Client Secret page, click Generate Secret.
  9. Copy the Client Secret and save it safely (it won’t be shown again).
  10. Click Next, then Finish.

Then I got another Client ID and secret from ADFS, which I used to get Access token in PostMan:

enter image description here

Now I am passing this Access token to call GetItems API but getting the same error from multiple solution tries:

{"error":"invalid_client","error_description":"Invalid audience Uri 'https:\/\/facilitiesuat.engro.com\/'."}

enter image description here

Any help here would be highly appreciated.

Thank you

enter image description here

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.