Microsoft Partner Center API – 401 Unauthorized when using access token
I am attempting to retrieve the list of customers from the Microsoft Partner Center API, but I am consistently receiving a 401 Unauthorized error when using the access token obtained from the Microsoft identity platform.
Steps to Reproduce:
Requesting Access Token
I successfully obtained an access token using the following POST request:
POST https://login.microsoftonline.com/<tenant_id>/oauth2/token HTTP/1.1
Host: login.microsoftonline.com
Content-Type: application/x-www-form-urlencoded; charset=utf-8
grant_type=client_credentials
&client_id=<your_client_id>
&client_secret=<your_client_secret>
&resource= https://api.partner.microsoft.com
In response, I receive a valid access token.
Calling Partner Center API
I am then using the token in the following API request to retrieve customer information:GET https://api.partnercenter.microsoft.com/v1/customers
Authorization: Bearer <access_token>
Content-Type: application/json
Issue
The response to the above GET request is as follows:
HTTP/1.1 401 Unauthorized
Content-Length: 0
Could you please assist in identifying why I am receiving the 401 Unauthorized error and what steps can be taken to resolve this issue?
I am attempting to retrieve the list of customers from the Microsoft Partner Center API, but I am consistently receiving a 401 Unauthorized error when using the access token obtained from the Microsoft identity platform.Steps to Reproduce:Requesting Access TokenI successfully obtained an access token using the following POST request:POST https://login.microsoftonline.com/<tenant_id>/oauth2/token HTTP/1.1
Host: login.microsoftonline.com
Content-Type: application/x-www-form-urlencoded; charset=utf-8
grant_type=client_credentials
&client_id=<your_client_id>
&client_secret=<your_client_secret>
&resource= https://api.partner.microsoft.comIn response, I receive a valid access token.Calling Partner Center APII am then using the token in the following API request to retrieve customer information:GET https://api.partnercenter.microsoft.com/v1/customers
Authorization: Bearer <access_token>
Content-Type: application/jsonIssueThe response to the above GET request is as follows:HTTP/1.1 401 Unauthorized
Content-Length: 0
Could you please assist in identifying why I am receiving the 401 Unauthorized error and what steps can be taken to resolve this issue? Read More