Configure non-interactive application setup
Non-interactive authentication is the primary authentication flow used to create and update data in AppDirect. For information on AppDirect's client credentials, see AppDirect's Client credentials.
Configure the AppDirect client setup
- Go to AppDirect > Manage > Marketplace > Settings > Integration > API Clients.
- Click Create API Client.
- Add the following values to the fields.
Field Value Name Salesforce-Auth-NIA Client Type Non-interactive application Grant Types Client Credentials Allowed Scopes System-level scopes Read and write Allowed IP addresses n/a
Configure Salesforce authentication provider
- Go to Salesforce.
- Click the gear icon and then select Setup.
- Go to Settings > Identity > Auth.Providers.
- Click New.
- Add the following values to the fields:
Field Value Provider Type AppDirectAuthProvider Name AppDirect-NIA URL Suffix ApppDirect_NIA Auth Provider Name AppDirect_NIA Consumer Key <consumer key generated during API client setup in AppDirect> Consumer Secret <consumer secret generated during API client setup in AppDirect> Default Scopes ROLE_PARTNER Token Endpoint URL callout:AppDirect_NIA/oauth/token Include Consumer Secret in API responses False Execute Registration As <search for integration user created in previous step>
Create a named credential
- Go to Salesforce.
- Click the gear icon and then select Setup.
- Go to Settings > Security > Named Credentials.
- Click New Named Credential.
- Fill in the values for the following fields:
Field Value Label AppDirect-NIA Name AppDirect_NIA URL https://<marketplace>.byappdirect.com Identity Type Named Principal Authentication Protocol OAuth 2.0 Authentication Provider AppDirect-NIA Scope n/a Start Authentication Flow on Save true Generate Authorization Header true Allow Merge Fields in HTTP Header false Allow Merge Fields in HTTP Body false Outbound Network Connection n/a - Click Save. The authentication is done and the authentication status is displayed on the details page.
- At the prompt, log in to AppDirect with an integration user.
You are then returned to the Named Credential setup screen, and the administration authentication status will be set to Authenticated.
Validate the authentication
Once the authentication is configured, you can test it with calls against AppDirect API endpoints.
- From Salesforce, click the gear icon and then select Developer Console.
- From the Developer menu, select Open Execute Anonymous Window.
- In the Enter Apex Code dialog, paste the following text (which tests the authentication flow against the Companies API):
/* Companies API Request - Non-Interactive Application */
HttpRequest req = new HttpRequest();
req.setMethod('GET');
req.setEndpoint('callout:AppDirect_NIA/api/account/v2/companies');
req.setHeader('Authorization', '{!$Credential.AuthorizationMethod} {!$Credential.AuthorizationheaderValue}');
req.setHeader('Accept', 'application/json');
req.setHeader('Content-Type','application/json');
HttpResponse res = new Http().send(req);
System.debug(res.getBody()); - Click Execute. The log appears in the Logs table.
- Double-click the log you generated.
- To see the response text, click the Debug Only checkbox.
Was this page helpful?
Tell us more…
Help us improve our content. Responses are anonymous.
Thanks
We appreciate your feedback!