ÃÛ¶¹ÊÓƵ

Integration of Salesforce using OAuth 2.0 client credentials flow configure-salesforce-with-ouath-2.0-client-credential

Version
Article link
AEM as a Cloud Service
Click here
AEM 6.5
This article

You can use OAuth 2.0 client credentials to integrate AEM Forms with the Salesforce application. OAuth 2.0 client credentials are a standard and secure method for direct communication without user involvement.

Workflow while setting communication between AEM Forms and Salesforce application

AEM Forms exchanges the client credentials (consumer key and consumer secret), defined in the Salesforce connected application, to obtain an access token.

There are multiple benefits of using OAuth 2.0 client credentials for authentication over Authorization Code Flow authentication:

  • OAuth 2.0 client credentials authentication allows more than five connections per user.
  • AEM data source configuration continues working on deactivation, access changes, password update for an AEM user.

Prerequisites prerequisites

Before setting communication between a Salesforce application and an AEM environment:

  • Create a and an API-only user for your organization and obtain the consumer key and consumer secret for the app.

  • Ensure that your Swagger file is appropriately configured to match your organization’s APIs. Alternatively, you can opt to create a Swagger file from the scratch, tailored for utilization in your AEM environment.

NOTE
AEM 6.5 only supports Swagger 2.0 file specifications.

+++

Steps to configure Salesforce with Client Credentials flow steps-to-create-aem-datasource-configuration

  1. Log in to your Author instance.

  2. Go to Tools > Cloud Services > Data Sources.

  3. Select the configuration folder.

  4. Click Create and the Create Data Source Configuration appears.

  5. Specify the Title and select the Service Type as RESTful Service.

  6. Click Next.

  7. Select the Swagger Source as File.

    note note
    NOTE
    As soon as the swagger file is selected, the Scheme, the Host name and the Base path are populated automatically.
  8. Upload the created swagger file from your local machine by clicking Browse.

  9. Select the Authentication Type as OAuth 2.0 and the Authentication Settings panel appears.

  10. Select the Grant Type as Client Credentials.

  11. Specify the Client Id and Client Secret obtained from the Salesforce connected app.

  12. Specify the Access Token URL in format
    https://[MyDomainName].my.salesforce.com/services/oauth2/token.

    note note
    NOTE
    Each organization has its own specific domain name.
  13. Click Test Connection.

  14. If the connection succeeds, click the Create button.

Now, you can create the Form Data Model to integrate the configured datasource with your Adaptive Forms.

recommendation-more-help
19ffd973-7af2-44d0-84b5-d547b0dffee2