Build an httpHelper flow

For each action card that you build in Connector Builder, the httpHelper flow manages authentication and any HTTP requests.

This supports the principle of software development to reduce pattern repetition.

Creating the httpHelper flow involves several tasks:

Here's an example of what a complete httpHelper flow looks like in Okta Workflows:

Before you begin

To build this common flow, first you need to:

Start this task

Create the httpHelper flow

  1. Create a flow under the Flows tab by clicking + New Flow.

  2. Click Add event and select Helper Flow.

  3. Click Save in the toolbar and name the flow httpHelper.

  4. Add a description to the flow so other builders on your team know the purpose of the flow. For example: This flow manages all authentication and http requests for the connector.

  5. Check the box Save all data that passes through the flow, and click Save.

  6. Add the following input names and data types to the Helper Flow card. Click the area that reads Click or drag to create, add the input name, and press the return key. Then select the type from the dropdown list that appears on the field itself.

    • relative_url, Text

    • request_method, Text

    • query, Object

    • headers, Object

    • body, Object

The next task builds out a series of cards to construct the proper objects for the HTTP call. Which option you choose depends on the authentication type you need to use.

Option 1: Build OAuth authentication

  1. Add a Text Concatenate function card to combine Bearer with your access token.

  2. In the text 1 field, enter Bearer . Include the space character, as that is part of the concatenation string.

  3. Drag the access_token field from the Helper Flow card into the text 2 field on the Concatenate card.

  4. Name the output field bearer by clicking the field's dropdown list and clicking customize. Renaming these fields is a best practice and not a requirement.

  5. Add an Object Construct function card after the Concatenate card.

  6. Click the area that reads Click or drop here to create and add the label Authorization.

  7. Drag the bearer output field from the Concatenate card to this field.

    After you do this, you can add any additional headers shared between all HTTP requests. For example, Content-Type, application/json.

  8. Rename the output field header by clicking the field's dropdown list and clicking customize.

Option 2: Build basic authentication

  1. Add a Text Concatenate function card to combine your username and password with a separating colon.

  2. Drag the username field from the Helper Flow card to the text 1 input on the Concatenate card.

  3. Manually enter a colon character : into the text 2 field on the Concatenate card.

  4. Drag the password field from the Helper Flow card to the area labeled Click or drop here to create on the Concatenate card.

  5. Rename the output field of the Concatenate card to username_password or another useful name.

  6. Add a Text Base64 function card. Drag the username_password field from the Concatenate card into the text input of the Base64 card.

  7. Rename the output field of the Base64 card to base_64 by clicking the field's dropdown list and clicking customize.

  8. Add another Text Concatenate function card to the flow.

  9. In the text 1 field, type Basic , including the space character.

  1. Drag the base_64 output from the Base64 card into the text 2 field of the second Concatenate card.

  2. Rename the output field of the second Concatenate card to auth_value.

  3. Add an Object Construct after the second Concatenate card.

  4. Click the Click or drop here to create area and add a label named Authorization.

  5. Drag the auth_value output field from the second Concatenate card to this field.

    After you do this, you can add any additional headers shared between all HTTP requests to your service. For example, Content-Type, application/json.

  6. Rename this output field header by clicking the field's dropdown list and clicking customize.

Option 3: Build custom (API key) authentication

  1. Add an Object Construct to the new flow.

  2. Click the area that reads Click or drop here to create and add the name of the key to include in your header. For example, api_key.

  3. Drag the api_key field from the Helper Flow card to this field.

    After you do this, you can add any additional headers shared between all HTTP requests. For example, Content-Type, application/json.

Finish the httpHelper flow

  1. Add an Object Merge function card to your flow.

  2. Drag the header output from the Construct function card into the object 1 field of the Merge card.

  3. Drag the headers output from the Helper Flow card into the object 2 field of the Merge card. This allows you to pass any necessary endpoint-specific headers.

  4. Rename the output field on the Merge card to merged_header.

  5. Add a Text Concatenate card to your flow.

  6. In the text 1 field, enter the base URL for the flow, without including a specific endpoint. For example, https://api.spotify.com/v1.

  7. Drag the relative_url field from the Helper Flow card into the text 2 field.

  8. Rename the output field on this card to full_url.

  9. Add a Raw Request action card from the API Connector.

  10. Drag the full_url output field from the Concatenate card into the URL input of the Raw Request card.

  11. Drag the request_method output field from the Helper Flow card into the Method input of the Raw Request card.

  12. Drag the query output field from the Helper Flow card into the Query input of the Raw Request card.

  13. Drag the merged_header field from the Merge card into the Headers input of the Raw Request card.

  14. Drag the body field from the Helper Flow card into the Body input of the Raw Request card.

  15. To add these three fields to the Flow Control Return card, click the area that reads Click or drop here to create:

  • status_code, Number

  • headers, Object

  • body, Object

  1. Drag the corresponding outputs from the Raw Request card into these newly created fields.

  2. Save and test your flow by manually adding a relative URL, a request method, and any other request data to the test dialog.

Next steps

Build an _authping flow