Choose an Authentication Method
Managed OAuth Connections
An OAuth connection is a reusable configuration owned by your organization. In your Code Action, you explicitly choose the connection to use on each fetch that needs authentication. Saving a connection or making it available to an Action does not add credentials to requests automatically. A fetch without an explicit connection selection receives no managed OAuth credential, even when its URL matches a saved connection’s allowed origins. Simple does not infer the credential from the destination or reuse the selection from a previous fetch. When you choose a connection for a request, Simple manages its token exchange and renewal. Your code selects the connection without copying its client secret or access token into source code. The supported grant is OAuth 2.0 client credentials (client_credentials): your agent acts on behalf of a service account or application. This does not implement a user’s browser sign-in, authorization-code callback, or refresh-token grant.
Create a Connection
- Open Configuration → OAuth Connections and add a connection.
- Enter a descriptive name and the provider settings below.
- Save the connection and use its test control to verify that the provider issues a token.
Extra token parameters and other connection settings are readable configuration. Put the client secret in its dedicated field; do not store additional secrets in descriptions, URLs, or extra token parameters.
Choose Authentication on Each Fetch
For every fetch in your Code Action, decide whether it needs managed authentication and explicitly choose the saved connection if it does. Selection applies only to that request. For example, a Code Action that calls the same CRM API twice can:- Fetch a public endpoint without choosing authentication. No managed OAuth token is added.
- Fetch a protected account endpoint and explicitly choose the Production CRM connection for that request.
Example: Choose an OAuth Connection in Code
With a saved OAuth connection namedproduction-crm that allows https://api.example.com, explicitly choose it for the request:
auth.fetch explicitly names the saved OAuth connection. Simple handles token acquisition, renewal, and secure attachment for that request. Another authenticated request must select its connection again. Ordinary fetch(...) receives no managed OAuth credentials.
How Tokens Are Obtained and Renewed
- Your code explicitly selects a connection for the fetch. Simple verifies that the selected connection exists, belongs to the organization executing the Action, and permits the destination origin.
- Simple reuses a cached token when it is sufficiently far from expiry. Otherwise, it exchanges the stored client credentials at the provider’s token endpoint.
- The access token is encrypted before it is cached. Concurrent requests coordinate token renewal to reduce duplicate exchanges.
- Simple attaches the selected connection’s token only to that explicitly authenticated request. Other fetches receive no managed OAuth credential unless they also select a connection.
Restrict Where Tokens Are Sent
Allowed origins match the exact HTTPS scheme, hostname, and port. Forhttps://api.example.com:
- Requests to
https://api.example.com/ordersand/customersmay use the connection when the fetch explicitly selects it. - Requests to a different subdomain, lookalike hostname, non-default port, or an HTTP URL do not qualify.
- Paths are not an access boundary: entering a URL with a path stores its origin. Each fetch must still explicitly choose the connection.
How Credentials Are Stored and Protected
Managed OAuth Credentials
- Encryption at rest: client secrets and cached access tokens use AES-256-GCM authenticated encryption.
- Write-only secrets: the client secret is accepted when creating or updating a connection, but is excluded from connection read responses. Those responses also exclude access tokens.
- Organization isolation: connection lookup and execution check organization ownership. Configuration read and write permissions control connection management.
- Runtime separation: Simple performs token exchange and header attachment outside the Code Action execution environment. The managed client secret and token are not supplied to the Action as inputs or configuration values.
- Safe test results: connection tests report success, token type, and expiry information rather than returning the access token. Provider response bodies and free-form OAuth error descriptions are omitted from token-exchange errors.
API Keys and Other Configuration Secrets
For credentials you use directly, open Configuration Variables, add a named value, mark it sensitive with the lock control, and save it. Use names such asCRM_API_KEY or BASIC_AUTH so Actions can reference them without embedding values in source code.
All configuration-variable values are encrypted at rest with AES-256-GCM. Marking a variable sensitive additionally omits its saved plaintext from configuration read responses. Variable names and descriptions remain visible, so keep secrets in the value field. Configuration edits record which variable names and fields changed without recording their values in the configuration audit event.
An HTTP Action references a variable with {{ config.CRM_API_KEY }}. A Code Action reads it as config.CRM_API_KEY. Unlike managed OAuth credentials, these values are available to the Action at runtime. Do not print them, return them as outputs, or interpolate them into conversation prompts. Marking a value sensitive does not make arbitrary Action code safe to log it.
Rotate or Revoke Credentials
To rotate an OAuth client secret, edit the connection and enter the replacement secret. Leaving that field empty preserves the stored secret. Saving the replacement invalidates the cached token so a subsequent execution exchanges the new credentials. For an API key, replace the sensitive configuration variable’s value. Keep the same name to preserve Action references. Remove unused connections and variables, and revoke old credentials with the provider. Deleting a connection in Simple does not revoke a token that the provider has already issued.Test Authentication
First test the OAuth connection to confirm the credentials can obtain a token. Then run the Action’s test panel to confirm that the selected connection, allowed origin, provider permissions, and API request work together. A successful token test alone does not prove access to a particular API endpoint.API Keys and Bearer Tokens
Use the header name and format required by the destination API. Common HTTP Action configurations are:
Choose the matching header for your provider; you do not need to send all three. A Code Action can set the same headers with
fetch:
Mutual TLS (mTLS)
mTLS authenticates the client with a certificate and its corresponding private key during the TLS connection. It can also be used with OAuth, as described in OAuth mutual TLS. Actions currently do not expose customer-provided client certificates or private keys for outbound requests. Adding a certificate to an HTTP header or configuration variable does not enable mTLS. To reach an API that requires mTLS, have the Action call an HTTPS endpoint in your own middleware. Authenticate that request with a supported method, such as an API key, and configure your middleware to present the client certificate when it calls the destination API. Certificate provisioning, renewal, and private-key storage belong in that middleware.Other Authentication Methods
For calls to Simple AI itself, use the handler’s
client: it is already authenticated for your organization. External services still require their own credentials.