Error AADSTS90002: Tenant 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX' not found when generating access token

Maxime BERNARD 21 Reputation points
2022-07-04T10:15:16.64+00:00

Hi,

I'm trying to generate access token from postman.

  1. I registered my app and got client_id + secret_id
  2. I created my app autorisations
  3. I got my tenant_id

Now i'm requesting this url : https://accounts.accesscontrol.windows.net/{tenant_id}/tokens/OAuth/2

But It throws me this error :

"AADSTS90002: Tenant 'XXXXXXXX-XXX-XXXX-XXXX-XXXXXXXXXXXX' 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"

I followed these 2 tutorials :

https://www.youtube.com/watch?v=uHwQzeyDc1A
https://global-sharepoint.com/sharepoint-online/in-4-steps-access-sharepoint-online-data-using-postman-tool/

Note : My sharepoints urls are like this
https://extranet.ortec.fr/Client/{sharepoint_name}, maybe I used the wrong SiteDomain in the body => resource (I used https://extranet.ortec.fr)

If anyone has I idea to fixed this it would help me so much !

Thx,
Maxime

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
11,176 questions
SharePoint Server Management
SharePoint Server Management
SharePoint Server: A family of Microsoft on-premises document management and storage systems.Management: The act or process of organizing, handling, directing or controlling something.
2,991 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Tong Zhang_MSFT 9,246 Reputation points
    2022-07-05T06:26:06.403+00:00

    Hi @Maxime BERNARD ,

    Per my test, If I enter the wrong Tenant_id in https://accounts.accesscontrol.windows.net/{tenant_id}/tokens/OAuth/2 ,I will get the same error. So, the error may be a result of getting the wrong Tenant_id. Please follow the steps to get the Tenant_id again, and test again.

    1.Input GET https://xxxx.sharepoint.com/sites/zellatest/_vti_bin/client.svc/

    Headers: Authorization Bearer

    Then you will get the WWW-Authenticate ,the realm=”xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx″ is SharePoint Online Tenant Id. (As shown in the screenshot)

    217606-image.png

    2.Using the Tenant_id to get access token. Hope it can help you.


    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.


    0 comments No comments

  2. Maxime BERNARD 21 Reputation points
    2022-07-05T08:00:11.357+00:00

    Hi @Tong Xin Zhang_MSFT

    This is already the way I found my tenant_id and it also matchs the tenant_id I got from : https://extranet.ortec.fr/Client/{sharepoint_name}/_layouts/15/appprincipals.aspx
    I guess it doesn't come from tenant_id but I don't have any idea of my mistake.

    Thx,
    Maxime


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.