I wanted to use IoT Central REST API call. But for using any REST API calls, we need an Authorization token.
So I want a way how we can create a new API Token in IoT Central programmatically.
From the below tutorial, found two ways :
- In the Administration section in your application's web UI on the IoT Central portal.
- Using the IoT Central REST API.
To generate an API token using the REST API, you must already have an Application administrator API token or a bearer token to authorize the call.
Now for getting bearer token, we have to use az cli which is not a feasible option for our approach. So instead of manually creating API token, we want a way to generate it programatically
Could you please give me some references on how to achieve this
A bearer token is associated with an Azure Active Directory user account, therefore you need to be authenticated to retrieve it.
With the bearer token you can generate an IoT Central Api Token programatically. The REST GET call is described here: https://learn.microsoft.com/en-us/rest/api/iotcentral/apitokens/get
See also: Authentication vs authorization doc