Configuring OAuth2.0 for Microsoft Dynamics (2016+)

If you're using an online Dynamics with an on premise server, you'll want to use Dynamics 365 OAuth2 authorization. This requires that you configure an App Registration in your Microsoft Entra ID.

1. Go to your Azure Portal and select Microsoft Entra ID > App Registrations > New Registration

2. Enter a name, select Single tenant as the account type and enter the redirect URL.

The redirect URL should be <project.baseurl>/oauth2/redirect where <project.baseurl> is the location Experlogix Smart Flows will be available as set in the application.properties in the Installation section.

For example: https://project.smartflows.xpertdoc.com/oauth2/redirect .

3. Select register to create the application registration.
4. After the Application Registration has been created, select API permissions and select ‘Add a permission’

5. Under the Microsoft API’s, select Dynamics CRM

6. Make sure that Access Common Data Service as organization users is checked and select Select

7. Select 'Add permission' to grant the permissions
8. Get the parameters we need in our Smart Flows configuration
9. Go back to the overview, find the Application ID and copy the value.

This is your clientid.

10. To get the clientsecret, select ‘Certificates & secrets’, and select on ‘New client secret’.

11. Give a description to the secret, set the expiration date and select 'Add'.

12. This will give you a value: the clientsecret. Copy this and store it as you will need it later on.

13. If your Dynamics CRM is not registered in the Microsoft Entra ID you created the application in, make sure to set multi-tenant to Yes in General Properties.
14. Configure the client Id and secret in the application.properties file of your smart flows installation:

Key

Value

value of the client id

dynamics.clientid

value of the client secret

dynamics.clientsecret

Example:

Copy

# where users will be accessing Smart Flows

server.port=443
project.baseurl=https://xsfl-server:443
Copy

# SSL certificate details

server.ssl.key-store=..\yourpfxfile.pfx
server.ssl.key-store-password=yourpfxpassword
server.ssl.key-store-type=pkcs12
Copy

# where the database is

project.datasource.jdbc-url=jdbc:sqlserver://localhost;database=smartflows-prod
project.datasource.username=sa
project.datasource.password=secretsapassword
Copy

# Password that will be used as the admin password

sample.user.password=secretadminpassword
Copy

# Dynamics app registration

dynamics.clientid=c8ef4bdb-4e17-4b9e-a48b-a698629a383d
dynamics.clientsecret=qXY]V.PE/n2e2lu4Z_GCdHGq4i7/tofQ