Skip to content

Using the Client Credentials Grant with the Gravity Forms Dynamics Add-On

Gravity Forms Dynamics 365

By default the Gravity Forms Dynamics CRM Add-On connects with the Authorization Code grant. You sign in with a Microsoft account that has Dynamics access, and the add-on keeps refreshing that sign-in. Microsoft limits how long a sign-in can be refreshed, so eventually someone has to reconnect. Until they do, entries don’t reach Dynamics.

The Client Credentials grant avoids that. The add-on connects as an app registration with a client ID and secret instead of as a person, so there’s no password to change and no Dynamics license to assign. Setup has three parts: an app registration in Microsoft Entra ID, an application user in Dynamics, and the add-on settings.

Create an app registration in Microsoft Entra ID

  1. Sign in to the Azure portal, go to Microsoft Entra ID > App registrations, and click New registration.

    The App registrations page with New registration highlighted

  2. Enter a name, such as “Gravity Forms Dynamics Add-On”, keep the other defaults, and click Register.

    The Register an application form with the name filled in and Register highlighted

  3. On the app’s Overview, copy the Application (client) ID and save it somewhere safe. You’ll paste it into the add-on later.

    The app Overview with the Application (client) ID highlighted

  4. Go to Manage > API permissions and click Add a permission.

    The API permissions page with Add a permission highlighted

  5. On the Microsoft APIs tab, click Dynamics CRM.

    The Request API permissions panel with the Dynamics CRM tile highlighted

  6. Check user_impersonation and click Add permissions. Dynamics CRM now appears in the list of configured permissions.

    The Dynamics CRM permissions with user_impersonation checked

  7. Go to Manage > Certificates & secrets and click New client secret.

    The Certificates & secrets page with New client secret highlighted

  8. Enter a description, choose when the secret expires, and click Add. The longest preset is 730 days (24 months). Set a reminder to create a new secret before it expires.

    The Add a client secret panel with a description and 730 days (24 months) selected

  9. Copy the secret’s Value right away and save it with the client ID. Azure only shows the value once. If you leave the page without copying it, delete the secret and create a new one.

Create an application user in Dynamics

  1. Sign in to the Power Platform admin center as a System Administrator.

  2. Go to Manage > Environments and open your Dynamics environment.

  3. Under Access, click See all under S2S apps. This opens the Application users page.

    The environment page with S2S apps highlighted under Access

  4. Click New app user.

    The Application users page with New app user highlighted

  5. Click Add an app.

    The Create a new app user panel with Add an app highlighted

  6. Search for the app registration you created, select it, and click Add.

    The app picker with the Gravity Forms app selected and Add highlighted

  7. Choose a Business unit.

  8. Click the pencil next to Security roles, select a role, and click Save. Pick a role that can create and update the records your feeds send, such as leads and contacts.

    The security roles list with a role selected and Save highlighted

  9. Click Create.

    The Create a new app user panel with the app and business unit filled in and Create highlighted

Set up the add-on

  1. In WordPress, go to Forms > Settings > Dynamics CRM.

  2. Under OAuth 2.0 Grant Type, select Client Credentials.

  3. Paste the Client ID and Client Secret you saved. The add-on fills in the Tenant ID from your Dynamics URL. If it can’t, enter your directory (tenant) ID from the app’s Overview page.

  4. Click Save Settings.

    The Dynamics CRM settings with Client Credentials selected and the Client ID, Client Secret and Tenant ID filled in

The add-on now connects to Dynamics as the app registration instead of as a named user.

Still need help?

Can't find what you're looking for? Send us a message and we'll get back to you.

Contact us