How to use IoT Central REST APIs using the bearer token generated by Microsoft Entra ID authentication
Wamakshi Bhati
0
Reputation points
Our requirement is to use the IoT Central REST APIs which use the bearer token authorization. The user will be authenticated using Microsoft Entra ID. For this, we are using MSAL node package. Once the user successfully signs in and we receive the access token, we want to use the same token to pass in IoT Central rest APIs.
However, on doing so the API returns 'AccessDenied' error in response
We have confirmed that the AAD tenant id which is the issuer of the token is same as the tenant id of IoT central, since the IoT central app and the microsoft entra id app is in same tenant.
{
"error": {
"code": "AccessDenied",
"message": "The provided authentication token was generated for the incorrect AAD tenant. Please use the home tenant of this account. You can contact support at https://aka.ms/iotcentral-support. Please include the following information. Request ID: 6lj4nvhl, Time: Fri, 22 Dec 2023 08:07:39 GMT.",
"requestId": "6lj4nvhl",
"time": "Fri, 22 Dec 2023 08:07:39 GMT"
}
}
Sign in to answer