In some cases, you'll want to perform a specific task that can be automated but needs access to the WorkflowGen GraphQL API; this use case is often in the form as a server-side script. For this, OAuth2 provides a type of grant called Client Credentials that simply exchanges a client ID and secret for an access token. There is no ID token since it's not part of the OpenID Connect standard and there's no user involved.
This section provides instructions on how to configure Azure AD with a server-side script that has access to the GraphQL API. First, you'll need to configure a new web application in the Azure portal; then, you'll need to configure a new application in WorkflowGen.
Make sure to have a licensed copy of WorkflowGen installed and running on a server.
Make sure to have administrative access to WorkflowGen.
Make sure to have administrative access to Azure Active Directory to be able to configure it properly.
Make sure to have successfully configured delegated authentication to Azure AD on your WorkflowGen instance following the instructions in the Azure Active Directory authentication section.
In the Azure portal, click App registrations in the Azure Active Directory section.
Click New registration, and fill in the properties:
Name: Your script name
Supported account types:
Accounts in this organizational directory only
Redirect URI: Leave this blank
Click Create at the bottom of the page.
You've now successfully registered your script in Azure Active Directory.
Click API permissions.
In the API permissions section, click Add a permission.
Click My APIs, then select the WorkflowGen Server application.
Click Delegated permissions, then select user_impersonation.
Click Add permissions.
In the application's menu, click Certificates & secrets.
In the Client secrets section, click New client secret and enter the following properties:
client_secret (or something that clearly identifies that it's a secret)
Copy and save the value generated by Azure. This is your client secret, and you won't be able to retrieve it later.
Here's a review of the information you'll need:
A client ID, which can be found on the registered application overview section.
A client secret, which is the value that you generated in the Certificates & secrets section.
Your Azure AD's tenant ID, which can be found in the properties sub-section in the Active Directory section in the portal.
The WorkflowGen GraphQL API's application ID, which can be found on the WorkflowGen server application's Expose an API section.
You're now ready to register your script in WorkflowGen.
As with user provisioning, WorkflowGen needs to know which application is accessing the GraphQL API. Therefore, you have to register the application, which consists of your script.
On the Applications page in the WorkflowGen Administration Module, click New application.
Fill in the form:
My Server Application
Description: A description that clearly identifies the script
Impersonate username: Any username that has the required access to the GraphQL API
Client ID: The client ID you retrieved earlier
Active: Check this checkbox
Your application should now appear in the list of applications.
You should now have the necessary components in place to make GraphQL API requests with your script by passing the access token received from Azure AD from a Client Credentials Grant flow.