Skip to main content

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

  1. Go to AppDirect > Manage > Marketplace > Settings > Integration > API Clients.
  2. Click Create API Client.
  3. Add the following values to the fields.
    FieldValue
    NameSalesforce-Auth-NIA
    Client TypeNon-interactive application
    Grant TypesClient Credentials
    Allowed Scopes
    System-level scopesRead and write
    Allowed IP addressesn/a

Configure Salesforce authentication provider

  1. Go to Salesforce.
  2. Click the gear icon and then select Setup.
  3. Go to Settings > Identity > Auth.Providers.
  4. Click New.
  5. Add the following values to the fields:
    FieldValue
    Provider TypeAppDirectAuthProvider
    NameAppDirect-NIA
    URL SuffixApppDirect_NIA
    Auth Provider NameAppDirect_NIA
    Consumer Key<consumer key generated during API client setup in AppDirect>
    Consumer Secret<consumer secret generated during API client setup in AppDirect>
    Default ScopesROLE_PARTNER
    Token Endpoint URLcallout:AppDirect_NIA/oauth/token
    Include Consumer Secret in API responsesFalse
    Execute Registration As<search for integration user created in previous step>

Create a named credential

  1. Go to Salesforce.
  2. Click the gear icon and then select Setup.
  3. Go to Settings > Security > Named Credentials.
  4. Click New Named Credential.
  5. Fill in the values for the following fields:
    FieldValue
    LabelAppDirect-NIA
    NameAppDirect_NIA
    URLhttps://<marketplace>.byappdirect.com
    Identity TypeNamed Principal
    Authentication ProtocolOAuth 2.0
    Authentication ProviderAppDirect-NIA
    Scopen/a
    Start Authentication Flow on Savetrue
    Generate Authorization Headertrue
    Allow Merge Fields in HTTP Headerfalse
    Allow Merge Fields in HTTP Bodyfalse
    Outbound Network Connectionn/a
  6. Click Save. The authentication is done and the authentication status is displayed on the details page.
  7. 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.

  1. From Salesforce, click the gear icon and then select Developer Console.
  2. From the Developer menu, select Open Execute Anonymous Window.
  3. 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());
  4. Click Execute. The log appears in the Logs table.
  5. Double-click the log you generated.
  6. To see the response text, click the Debug Only checkbox.

Was this page helpful?