Skip to Content
Technical Articles

Connector Builder Guide – Store Response Data to the Configuration

Connector Builder Guide – Store Response Data to the Configuration

Open Connectors consists of over 170 connectors to 3rd Party Applications natively embedded in the SAP ecosystem. If the Connector you need does not exist in the catalog, you can build it quickly with Connector Builder. This instruction guide will walk you through using this tool, with concrete examples throughout. The beginning, Part 1, can be found here.

 

Example – Client Credentials Authentication

This example will be generating an access token from the OneLogin API Documentation. The Connector will then store this token in a configuration variable.

First, the user has to enter her client_id and client_secret when creating a Connector Instance. Let’s add three configuration keys. A key, secret, and a token, to store the access token once we generate it.

To generate the token, we will create a resource on the next screen, the Resources screen, of Connector Builder.

Editing this newly created resource expands the resource

 

First, the vendor method is changed to POST. The vendor path is changed to https://api.<us_or_eu>.onelogin.com/auth/oauth2/token so that it isn’t appended to the base URL in Setup screen. A parameter is added to send the Authorization header with a value of client_id:<client_id>, client_secret:<client_secret>

To use a configuration variable here, the format is ${configuration.<<key name>>}

A different parameter is created to store the response, specifically the bodyToken data[0].access_token value in the configuration variable we created before called token. Notice how the source this time is set to Response.

Here is the response in full:

{
  "status": {
    "error": false,
    "code": 200,
    "type": "success",
    "message": "Success"
  },
  "data": [
    {
      "access_token": "xx508xx63817x752xx74004x30705xx92x58349x5x78f5xx34xxxxx51",
      "created_at": "2015-11-11T03:36:18.714Z",
      "expires_in": 36000,
      "refresh_token": "628x9x0xx447xx4x421x517x4x474x33x2065x4x1xx523xxxxx6x7x20",
      "token_type": "bearer",
      "account_id": 555555
    }
  ]
}

We should also create a configuration variable to hold the expires_in and refresh_token bodyTokens.

 

To recap, we have asked the user for their client_id and secret, have made a call out to OneLogin to get the token, and stored the access_token in the token configuration variable.

There is an important point to explain. In the Configuration in the image above, the resource type is set to Provision Auth Validation. For normal API calls, it is set to API. Provision Auth Validation means that when you create a Connector Instance, this call will run automatically, which means it will get the access_token and store it to the configuration variable called token.

One last point. If we add a configuration variable called expires_in, this will tell the resource with type PROVISION AUTH VALIDATION when to run again. It is in seconds.

Now you have learned how to automatically make a call after creating an Instance of a Connector and store parts of that response in Configuration variables.

Be the first to leave a comment
You must be Logged on to comment or reply to a post.