For external APIs that require a security token to access the API we need to create an API call that requests a token.
With Flowfactory this is a simple procedure. Example below shows the final workflow to request a token before calling the external API.
Step 1-3 describe how to manually create the required contracts to request a access token for a Flowfactory application. We have created an OpenAPI-definition that will create these for you. To import the definition just go to Integrations → Consume API and then click Import OpenAPI definition and past the contents of this file in the textbox. This will create everything in step 1-3.
1. Request Token Entity
First we create an entity that contains the information needed to Authenticate a user to access the API. In this example we use a username and password.
2. Access Token Entity
Then we need another Entity that holds the result from the Authentication call. So we create an Access Token Entity like described below.
3. Authentication Consume API
Finally we need to create a Consume API that we configure to call the external API endpoint with the Request Token Entity as Parameter and the Access Token Entity as result.
4. Making the Call
Now we have configured all the parts to Authenticate an API that requires a security token and all that is left is to connect all parts in a workflow.
We start by creating a new workflow and a Create Entity Activity which we set to our Request Token Entity.
Then we assign a username and password with a user that has access to the external API we want to call
From our Create Request Token Activity we now connect parameters to the Request Token REST API Call Activity.
This will use your Authentication information and pass that to the external API and thereby requesting a Authentication Token.
From the Request Token REST API Call Activity we can now get the result of the API Call and push that forward to the next API Call by binding the resulting Access Token to the in-parameter Token of the Call REST API Method Activity
Now we have an Authentication flow that can be reused in other workflows where we need to Authenticate against an external API.
Comments
0 comments
Please sign in to leave a comment.