This
Use the Dynamic Application Builder tool with caution, as you can overload your Skylar One system with added collections created using the Dynamic Application Builder.
Authenticating to OAuth2 Endpoints
Starting with version 1.5.1, the Dynamic Application Builder supports authentication to endpoints that use an OAuth2 bearer token header (or similar API key headers). There are two ways to obtain and manage the bearer token:
-
Use an external tool, such as Postman.
-
Use the Dynamic Application Builder by configuring a second credential pointed at the authorization endpoint.
Obtaining a Bearer Token Using an External Tool
Before authenticating using OAuth2 or an API Key, you must obtain a bearer token from the authorization endpoint of your target service. In the steps below, Azure is used as an example, and Postman is used as an example tool. To obtain a bearer token in Postman:
-
In Postman, send a POST request to the https://login.microsoftonline.com/<subscription_id>/oauth2/token Azure authorization endpoint.
-
In the response payload, locate the access_token field. This value is the bearer token used to authenticate requests to any Azure API endpoint.
-
Add a request header with the key defined as Authorization and the value defined as bearer <access_token>, where <access_token> is the token value from the authorization response.
Bearer tokens expire after a period set by the API service. Typically this expiration period is between one hour and one day. Once the token expires, you must request a new one and update the header value.
Creating a Credential Using the Bearer Token
Once you have configured the bearer token in Postman, you can configure the same credential in the Dynamic Application Builder as long as the token is still valid. Once the credential is configured in the Dynamic Application Builder, you can retrieve payloads directly. To create a credential:
-
Follow the other steps for creating a credential in the Dynamic Application Builder.
-
Enter Authorization in the Header Key field under the Request Headers section.
-
Enter bearer <access_token> in the Header Value field, where <access_token> is the token value from the authorization response.
-
Click the button.
-
Click the button.
You can now fetch OAuth2-authenticated payloads in new or existing Dynamic Applications using this credential.
When the bearer token expires, and you have obtained a new one, update it on the tab by replacing only the <access_token> part of the value in the Header Value field. To edit the existing header, click on the existing value in the list of Request Headers, update the value, and click .
Creating and Managing Bearer Tokens in the Dynamic Application Builder
You can obtain and manage bearer tokens entirely within the Dynamic Application Builder, without using Postman or another external tool. If the authorization endpoint is the same as the data endpoint, you can reuse the existing credential. If the API uses a separate login URL, as Azure does, create a second credential specifically for the authorization endpoint. The following example workflow provides instructions for a two-credential approach using Azure as an example, where the token endpoint is different from the management APIs used to retrieve data. To create a second credential:
-
In the Dynamic Application Builder, select an existing Azure login credential.
-
Create a temporary Dynamic Application and navigate to the tab.
-
On the Retrieve Payload step, select Post from the HTTP Method field.
-
Click the tab.
-
Enter the following payload in the Request Payload (DATA) field, where <CLIENT_SECRET> and <CLIENT_ID> use the correct values from your Azure account:
client_secret=<CLIENT_SECRET>&grant_type=client_credentials&resource=https://manag ement.azure.com&client_id=<CLIENT_ID>
-
Click . The response will contain the bearer token.
-
Copy the token value from the payload response and return to the Collect Credential step of the Dynamic Application Builder.
-
Switch the active credential to the Azure Management API credential.
-
Enter Authorization in the Header Key field under the Request Headers section.
-
Enter bearer <access_token> in the Header Value field, where <access_token> is the token value from the payload response.
-
Click the button.
-
Click the button.
-
You can now fetch OAuth2-authenticated payloads in new or existing Dynamic Applications using this credential.
Authenticating with API Key Endpoints
Authenticating against API key endpoints follows the same procedure as authenticating with OAuth2 endpoints. The primary difference is that instead of using a bearer token, your API provider supplies a specific header name and key value to include in your requests. API keys typically have longer lifespans than OAuth2 tokens, because the API controls when the key rotates.
To configure access, add the header name and value provided by your API to the Dynamic Application Builder credential. Once saved, those headers are automatically included with all requests made from the Retrieve Payload step and the button in the Define Collection Objects step.