question

$$ANON_USER$$ avatar image
0 Votes"
$$ANON_USER$$ asked RaytheonXie-MSFT commented

Tenant ID not found. Sharepoint API - Postman - Authnetication Token

Hello Folks,

I am registering an app on SharePoint to make List accessible to external form. App registration has been done and currently working on getting:

  1. Tenant ID

  2. Access Token

I am getting the tenant ID but when using it in postman for getting access token. Gives this error:

{
"error": "invalid_request",
"error_description": "AADSTS90002: Tenant 'xxxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx' not found. Check to make sure you have the correct tenant ID and are signing into the correct cloud. Check with your subscription administrator, this may happen if there are no active subscriptions for the tenant.\r\nTrace ID: d6542975-b71f-4d59-bdb3-0a4162959400\r\nCorrelation ID: 9b3bdd83-672c-413f-b0fa-ffb044c6f633\r\nTimestamp: 2021-10-08 12:46:17Z",
"error_codes": [
90002
],
"timestamp": "2021-10-08 12:46:17Z",
"trace_id": "d6542975-b71f-4d59-bdb3-0a4162959400",
"correlation_id": "9b3bdd83-672c-413f-b0fa-ffb044c6f633",
"error_uri": "https://accounts.accesscontrol.windows.net/error?code=90002"
}


Thanks in advance.

sharepoint-dev
· 4
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi anonymous user ,
would you please provide us with an update on the status of your issue?

0 Votes 0 ·

Hi anonymous user ,
I am checking to see how things are going there on this issue.

0 Votes 0 ·

Hi anonymous user ,
If there's anything you'd like to know, don't hesitate to ask.

0 Votes 0 ·

Hi anonymous user ,
If you have any questions or progress, you can contact me in time.

Looking forward to your reply

Have a lucky day!

Thanks,
Raytheon Xie

0 Votes 0 ·
RaytheonXie-MSFT avatar image
0 Votes"
RaytheonXie-MSFT answered

Hi anonymous user ,
First we should confirm the permission to the list in the following link

 https://YourSharePointOnlineSiteUrl/_layouts/15/appinv.aspx

139273-image.png

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

Then create and click trust it
139294-image.png
Please check the steps in following link in register app
https://docs.microsoft.com/en-us/sharepoint/dev/solution-guidance/security-apponly-azureacs

We can get Tenant ID in following url

 https://YourSPOSiteURL/_vti_bin/client.svc/

139167-image.png

The id marked with blue is Tenant ID in the picture.



If an Answer is helpful, please click "Accept Answer" and upvote it.
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.



image.png (136.8 KiB)
image.png (181.3 KiB)
image.png (115.9 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

$$ANON_USER$$ avatar image
0 Votes"
$$ANON_USER$$ answered RaytheonXie-MSFT commented

Thanks @RaytheonXie-MSFT for your reply.
I've tried all above mentioned steps. But when I calling api for access Token it gives the error of wrong tenant ID or Tenant not found.

I am using SharePoint On-Premise.

· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi anonymous user ,
There is no such concept of "access Token" in SharePoint On-Premise. I would recommend you FormDigestValue instead.
Step 1 – Get your SharePoint site’s FormDigest using Contextinfo call

1.In Postman, the contextinfo endpoint URL for your SharePoint Site…something like: https://mySharePointSite/_api/contextinfo
2.Set the Accept header: application/json;odata=verbose
3.Set the html verb to POST
4.Hit Send
139677-image.png

With Results:
1.Copy the big string of characters inside the <d:FormDigestValue> ~~~ </d:FormDigestValue> tags

Step 2 – Make your HTML GET Request (or POST if you’re posting)

1.Enter your endpoint URL…something like: https://mySharePointSite/_api/web/lists/getbytitle(‘MyListName’)/items?$select=Title
2.Set the Accept header: application/json;odata=verbose
3.Set the HTML verb to GET (if you’re getting data. POST or PUT or whatever if you’re doing something else)
4.Add the header X-RequestDigest and paste the FormDigestValue copied above into it
5.Hit Send, and you should be good to go

The following articles for your reference:

Testing SharePoint 2016 or 2013 or SharePoint Online REST API using Postman

https://social.technet.microsoft.com/wiki/contents/articles/37381.testing-sharepoint-2016-or-2013-or-sharepoint-online-rest-api-using-postman.aspx


0 Votes 0 ·
image.png (118.6 KiB)

Hi anonymous user ,
Would you tell me whether your issue has been resolved or have any update?
I am looking forward to your reply.

Have a nice day!

Thanks,
Raytheon Xie

0 Votes 0 ·