Generic HTTP Connector
The Generic HTTP Connector enables integration between Descope and any third-party HTTP API. Use it to pull data into Descope flows (e.g., user information) or push data to external services.
Configuration
To integrate the Generic HTTP Connector into your project, navigate to the Connectors page, select the Generic HTTP connector, and configure the following parameters:
- Connector Name: Assign a custom name to your connector. This is especially useful for distinguishing among multiple connectors derived from the same template.
- Connector Description: Provide a brief description of your connector's purpose.
- Base URL: Root URL of the third-party API (e.g.,
https://api.example.com). The URL can include dynamic values. - Authentication Type: Choose how to authenticate with the third-party API.
- Request Headers (Optional): Key-value pairs to be included in API requests. For each header, you can choose to save the value as plain text or mark it as a secret. Secret values are encrypted and are not displayed again after saving.

- HMAC Secret (Optional): Signs the request and sends the result in an
x-descope-webhook-s256header. Learn more, including how to customize what gets signed. - AWS Signature V4 (Optional): Enable AWS Signature V4 for signing requests.
- RFC 9421 HTTP Message Signatures (Optional): Enable RFC 9421 HTTP Message Signatures for cryptographically signing requests. Supports multiple algorithms including ECDSA, Ed25519, RSA, and HMAC.
- Use mTLS (Optional): Presents a client certificate to the third-party API during the TLS handshake. See Mutual TLS (mTLS) below.
- Trust any certificate: If enabled, disables SSL verification. Default is disabled (recommended).
- Include response headers and status code in Context: Adds response headers and status code to the connector context (
context.headersandcontext.statusCode). Default is off. See Accessing HTTP Response Headers and Status Code below. - Use Static IPs: If enabled, the connector uses a predetermined pool of IPs from which all requests will be made. See Static IP Addresses below.
Once you've configured all of these settings, you can test the connector in the connector configuration page.
Authentication Methods
The Generic HTTP Connector supports several authentication mechanisms. Choose the one that matches the requirements of the third-party API you are connecting to:
- Bearer Token: Requires a token. It is included in the
Authorizationheader asBearer <token>. - API Key: Requires a key name and key value. The key is sent as a header (e.g.,
x-api-key: <value>). - Basic Authentication: Requires a username and password, which are sent as a
BasicAuthorization header (Basic <base64-encoded-credentials>). - OAuth 2.0 (Client Credentials): Requires client credentials to dynamically obtain and use an access token. See details below.
OAuth 2.0 (Client Credentials Flow)
When using OAuth 2.0, Descope will handle token retrieval and injection into requests automatically. You must provide the following:
- Client ID
- Client Secret
- Token Endpoint URL
- Scopes (optional; space-separated string)
- Credential Placement: Choose whether to send the credentials:
- In the request body
- In the Authorization header using HTTP Basic (default)

Descope will fetch and cache the access token using the client credentials flow and include it in the Authorization header for subsequent requests.
Authentication field values (token, key value, username, password, client ID, client secret) also support dynamic values instead of static text.
Mutual TLS (mTLS)
Some APIs accept a connection only from a client that presents a certificate the API trusts. This setup is called mutual TLS (mTLS), and it is common for internal and partner APIs. With mTLS, the API identifies Descope from the TLS connection itself, so it doesn't depend only on a token or key in the request.
mTLS works next to the Authentication Type you select, not in place of it. You can use mTLS by itself, or together with a bearer token, API key, or OAuth 2.0 credentials when the API asks for both. To set it up, turn on Use mTLS and fill in these fields:
- Client Certificate: The PEM certificate that Descope presents to the API.
- Client Private Key: The PEM private key that matches the client certificate. The key must not have a passphrase, because the connector has no passphrase field.
- CA Certificate (Optional): A PEM certificate for a private or internal CA that signed the API's server certificate. When you leave it empty, the connector checks the server certificate against the public trust store.

Descope stores all three values encrypted. mTLS needs a Base URL that starts with https://. When the API redirects a request to a different origin, the connector doesn't follow the redirect, so Descope never presents the certificate to a host you didn't configure.
Testing
Before deploying your connector, it's crucial to verify its configuration:
- Use the Descope Console to test your HTTP connector and verify the integration—for example, pulling user details from an external API.
- Use the Test button to review the response in the test panel.
This test ensures that your connector is properly set up and can communicate with the third-party API successfully.

Handling HTTP Status Codes
You can handle different HTTP responses with status code rules in the connector action's error handling. A rule matches 4xx, 5xx, a specific code such as 404, or All, which also covers timeouts and network errors. Each rule has its own retries (up to three), error handling after the last retry, and error message.
You can also branch on the exact status code with conditions.
Step 1: Enable Custom Error Handling
Configure the connector action to use Custom error handling for the Generic HTTP Error event. The flow then takes a new path whenever the response code isn't in the 2xx range.

You can also set Connector Execution error handling to Custom to handle errors with the connector itself.
Step 2: Add Conditional Logic
You'll need to rely on the context key for your connector to access the response code in a condition block.
Use the key connectors.<Context Key>.statusCode to access the response code in flow conditions.
Example use cases:
- 404 → Show "User Not Found" screen.
- 429 → Return to login screen.
- Other errors → Restart the flow.

For a complete list of response codes, you can visit the HTTP Status Codes page.
Step 3: Build Flow Logic
Connect conditions and screens to build the complete flow logic. This is an example of a flow that will restart the process if a 429 rate limit error occurs, but will show a "User Not Found" screen if a 404 error occurs.

Accessing HTTP Response Headers and Status Code
Enable the Include response headers and status code in Context option in the connector settings to access them in your flow as context.headers and context.statusCode.
For example, you can:
- Extract custom headers.
- Use them in a Custom Claims action.
- Add the values to the JWT.
{
"customHeader": "My header value",
...
}

HMAC Signature Customization
By default, setting an HMAC Secret (see Configuration) signs the entire JSON request body and sends the result in the x-descope-webhook-s256 header, as described in Using HMAC Authentication Type. If you need to sign something other than just the body—for example, the request method, URI, or specific headers—you can customize the signature template using the same HMAC Secret.
Configure Signature Template
In the connector settings, set a x-descope-signature-template header with a comma-separated list of elements to sign:
Example template:
METHOD,URI,HEADER_x-descope-timestamp,BODY
Descope will compute the HMAC and send it in the x-descope-webhook-s256 header.

Example Headers Sent
{
"x-descope-webhook-s256": "xxxxx",
"x-descope-timestamp": "1717787565548",
"x-descope-signature-template": "METHOD,URI,HEADER_x-descope-timestamp,BODY"
}Validating the Signature
Use the following example to validate the HMAC signature in your backend:
import crypto from "crypto";
function verifyHmacSignature(payload, secret, sentHmac) {
const hmac = crypto.createHmac("sha256", secret).update(payload).digest("base64");
return sentHmac === hmac;
}
export async function validateHMAC(req) {
const secret = "ConfiguredSigningSecret";
const template = req.headers["x-descope-signature-template"];
let signature = template.replace("METHOD", req.method).replace("URI", req.url);
if (template.includes("BODY")) {
signature = signature.replace("BODY", JSON.stringify(req.body || {}));
}
const headerMatches = template.match(/HEADER_([a-zA-Z0-9-_?~]+)/g) || [];
headerMatches.forEach(h => {
const name = h.replace("HEADER_", "");
signature = signature.replace(h, req.headers[name] || "");
});
const sentHmac = req.headers["x-descope-webhook-s256"];
return verifyHmacSignature(signature, secret, sentHmac);
}Dynamic Base URL
The API you call often lives at a different host for each region, tenant, or customer environment. Instead of creating one connector per host, you can put dynamic values in the Base URL. Descope fills them in from the flow context each time the connector runs.
Wrap each context key in double curly braces. You can mix static text with one or more keys:
| Base URL | Resolves from |
|---|---|
https://{{scripts.regionHost.subdomain}}.api.example.com | A scriptlet that maps the user's region choice to one of your known subdomains |
https://api.example.com/tenants/{{tenant.id}} | The tenant selected in the current flow |
{{scripts.lookupHost.baseUrl}} | The output of a scriptlet that ran earlier in the flow |
https://{{connectors.dbResult.region}}.api.example.com | The result of another connector that ran earlier in the flow |

The value must exist in the flow context when the connector runs. Run the screen, scriptlet, or connector that sets it before the HTTP connector action.
Don't let user input set the host
The connector sends its authentication credentials and secret headers with every request. If a value the user typed sets the host, a value such as evil.example# sends those credentials to another server. Map form values and flow inputs to one of your known hosts first, for example in a scriptlet, and never put them in the host directly.
Dynamic Values in Headers
You can inject dynamic values (e.g., form fields or flow inputs) into headers. These can also be dynamic values generated from a connector or scriptlet.
Using Values from Other Connectors
A common use case is chaining connectors together, where one connector's output becomes another connector's input.
You can use the output of a connector and include it in the request body of your generic HTTP connector in the flow itself. However, if the output of the one connector must be included in the headers of your generic HTTP connector, you can do that as well. Here's an example:
- First, use a Database Connector to fetch a user's profile
- Then, use the Generic HTTP connector to call an external API, passing the user's data in headers
Example flow:
{
"x-user-id": "{{connectors.dbResult.user.id}}",
"x-user-role": "{{connectors.dbResult.user.role}}",
"x-tenant-id": "{{connectors.dbResult.tenant.id}}"
}This can also be used if there's a dynamic token that needs to be included in the headers of the Generic HTTP connector for authentication, without relying on the OAuth 2.0 Client Credentials flow.
Example
Header configuration in the connector:
{
"x-descope-form-email": "{{form.email}}",
"x-descope-testid": "{{form.testID}}"
}Example of received headers:
{
"x-descope-form-email": "chris+200@descope.com",
"x-descope-testid": "12345678"
}
Dynamic Values in Authentication
You can use the same {{}} syntax from headers in the connector's authentication fields. Set the Bearer token, API key value, Basic username or password, or OAuth 2.0 client ID and secret as a dynamic value from a form field, scriptlet output, or another connector's result.
For example, generate a unique correlation ID with a scriptlet and pass it into an authentication field, such as a Basic Authentication username or an OAuth 2.0 client secret.
Example
Basic Authentication configuration in the connector, with a dynamic username and a static password:
{
"username": "{{scripts.scriptletResult.correlationId}}",
"password": "static-password"
}Static IP Addresses
When using the Generic HTTP Connector, you may want to restrict access to your third-party API by IP address. Descope provides the option to route all requests from the connector through a set of static IPs.
In the connector configuration screen, you can enable Use Static IPs. When this option is selected:
- Descope will route all outgoing requests through a predefined set of IP addresses.
- These IPs are displayed in the UI for you to copy and allow-list on your API gateway, firewall, or server.
