Two main authorization flows work with the cloud version of Microsoft Dynamics 365 Business Central:
Client Credentials Flow, represented by the
AzAppoption.Authorization Code Flow, represented by the
AzUserandAzDelegateoptions.
These flows are part of OAuth.
Client Credentials Flow
In Client Credentials Flow, the portal contacts Microsoft Dynamics 365 Business Central in an authenticated manner through these steps:
# | Actor | Step |
|---|---|---|
1 | User | Accesses the portal. |
2 | Portal | Checks if a valid token exists in the session. If it does, steps 3 to 5 are skipped. |
3 | Portal | When no valid token exists or the existing token is expired, sends a request to the Authority for a new access token using the client ID and client secret. |
4 | Authority | Sends back an access token. |
5 | Portal | Stores the retrieved access token in the session. |
6 | Portal | Uses the stored access token to send authenticated requests to Microsoft Dynamics 365 Business Central. |
7 | User | Uses the portal, now connected successfully to Microsoft Dynamics 365 Business Central. |
Note
Client Credentials Flow (AzApp mode) is the preferred mode because it does not require user interaction.
Authorization Code Flow
In Authorization Code Flow, the portal contacts Microsoft Dynamics 365 Business Central in an authenticated manner through these steps:
# | Actor | Step |
|---|---|---|
1 | User | Accesses the portal. |
2 | Portal | Checks if a valid token exists in the session. If it does, steps 3 to 8 are skipped. |
3 | Portal | When no valid token exists or the existing token is expired, redirects the user to the |
4 | User | Logs in to their Microsoft account if not already logged in. |
5 | User | Authorizes the app if not already authorized. |
6 | Authority | Redirects the user back to the URL defined as the |
7 | Portal | Sends a server-side request to the Authority to get an access (Bearer) token using the received authorization code. |
8 | Portal | Stores the retrieved access token in the session. |
9 | Portal | Uses the stored access token to send authenticated requests to Microsoft Dynamics 365 Business Central. |
10 | User | Uses the portal, now connected successfully to Microsoft Dynamics 365 Business Central. |