Testing a Connector with Localhost

For developers, there might be scenarios where they wish to test an API running on their localhost from an external source.

This article will cover how to test connectors against an API running on localhost. This is particularly useful for preliminary testing of Descope's Connectors using a locally hosted API.

Note

The HTTP Connector being tested in this manner is a particular example of using tunnels to test locally deployed services. This method can be used to test any connector, or API, that requires a public URL.

Prerequisites:

  1. A working REST API running on your localhost.
  2. A service/tool that can temporarily expose your localhost API to the internet. Some popular options are:

Step-by-step Guide:

Deploy your API using a chosen service

Choose any of the above-mentioned services to expose your local API to the internet. Once exposed, note down the public URL as it will be used in the next step.

Configuring the HTTP Connector

Navigate to the Descope's HTTP Connector configuration page and fill in the required parameters:

  • Connector Name: Provide a unique name for your connector. This assists in distinguishing it, especially when multiple connectors are derived from the same template.
  • Connector Description: Briefly explain the purpose of this connector.
  • Base URL: Input the consistent section, or the root, of your API's URL. This should start with either http:// or https://. Use the public URL from Step 1.
  • Authentication Type: Descope supports various methods to authenticate with your service. Choose the method that suits your API:
    • Bearer Token: Used for access keys such as JWTs.
    • API Key: This usually involves a key-value pair.
    • Basic Authentication: The traditional username and password method.
    • None: Select this if your API doesn't require any authentication.
  • Headers (Optional): Some APIs need specific headers, usually key-value pairs, to provide more details about the impending action.
  • HMAC Secret (Optional): HMAC is a symmetric key method for message signing. The provided secret will be used to sign the payload. The outcome signature will be sent in the x-descope-webhook-s256 header. The recipient service should use this secret to validate the payload's integrity and authenticity by verifying the supplied signature.
  • Trust Any Certificate: By default, this option is turned off. If enabled, the client will overlook any certificate errors. While convenient for testing, it's crucial to remember that this is an insecure choice for production.

Twilio connector widget input

Running the Flow

Once you've configured the HTTP Connector and added it in the Flow Editor, you can run your flow locally. During this process, the conector should be integrated seamlessly.

Final Steps

After you've completed your tests, consider deploying your API to a more stable service. Once done, revisit the HTTP Connector configuration page to update it with the new parameters from your permanent API deployment.

Note

The HTTP Connector being tested in this manner is a particular example of using tunnels to test locally deployed services. This method can be used to test any connector, or API, that requires a public URL.

Was this helpful?

On this page