Acquiring an authentication token from Microsoft Entra ID
In order to use Dynamics 365 Business Central APIs, you need to request an authentication token to Microsoft Entra ID. An authentication result from Microsoft Entra contains an access token and an ID token. The access token is the token we need to use to call Dynamics 365 Business Central APIs (as a Bearer
token in the Authorization
header of the incoming API call):
Authorization: Bearer <token>
Remember that an access token is short-lived (one hour by default and one day maximum). When it expires, the client application needs to request a new access token.
Here is an example of HTTP requests that you need to send in order to obtain an authentication token with S2S authentication flow:
I’m using the Rest Client extension from Visual Studio Code to send the needed HTTP requests for the authorization flow. You can obtain the extension from the Visual Studio Code Marketplace or from here: https...