Token request operation


info

Once the operation has been configured, a support request will need to be created so that a Tray engineer can enable token request for the specified Service.

Overview

The token-request operation in tray.io connectors is designed to address scenarios requiring customized authentication or token refresh logic that extends beyond the standard configurations available on the service.

This feature is particularly useful in cases where the default OAuth or API key-based authentication mechanisms do not suffice, and there is a need to implement bespoke authorization workflows. For instance, it may be necessary to interact with a proprietary authentication service, handle non-standard token exchanges, or integrate complex multi-step authentication processes.

Similarly, custom refresh logic can be critical for managing token lifecycles in a way that standard refresh token flows cannot support, ensuring continuous and secure access to APIs.

This flexibility allows for seamless integration with a broader range of services and systems, enhancing the robustness and adaptability of automated workflows.

Example Implementation

To do this, you need to add a #token-request operation in your src folder.

A #token_request operation is used to obtain or refresh an access token for a given connector request.

You can find an example implementation of this request on the examples repo.

Notes:

  • An operation needs to be created and configured to match the name #token_request.
  • The operation will not be visible in the Workflow Builder UI.
  • Once enabled on the service level by Tray, the operation will be run in the background on workflow execution.
  • In the example, the operation is used to generate an access token and populate the auth for subsequent operations.
  • Input for the token request is populated from the Service level. In the example the client id, client secret and account_id are provided to the request from input in the Service.

Contact Support

Once the operation has been configured, a support request will need to be created so that a Tray engineer can enable token request for the specified Service.