Connect an integration that signs in with OAuth

Use this page when an integration acts on a service with an OAuth connection instead of a stored key. Whether its tools use the team's connection or the connection of the person who started the task is set by connection.actsAs; see Acts as.

You need:

  • An account at the service that may grant the scopes the integration requests.
  • The integration created for the team with a connection.oauth2 block, as below.
  • An OAuth app of the team at the service, with the redirect URL https://app.usespotlight.ai/api/integrations/oauth/callback (on a self-hosted Spotlight, your deployment's address in its place), and its client secret stored as a workspace secret. See spotlight_secret. For a remote MCP server, or other ways to get a client, see Use another OAuth client.
  • To connect the team: to be an owner or admin of the workspace. To connect yourself: to be on the team.

Declare the connection

If the integration does not have one yet, add connection.oauth2 to its definition, and have the requests that act on the service use it. With the Terraform provider:

resource "spotlight_integration" "core_acme" {
  team_id = spotlight_team.core.id
  definition = {
    integration = "acme"
    name        = "Acme"
    connection = {
      oauth2 = {
        authorize = "https://acme.example/oauth/authorize"
        token     = "https://acme.example/oauth/token"
        scopes    = ["issues:write"]
        identity  = "$${{ response.account.name }}"
        client    = { id = "<client id>", secret = "secret.ACME_CLIENT_SECRET" }
      }
    }
    actions = {
      comment = {
        request = {
          method = "POST"
          url    = "https://api.acme.example/comments"
          body   = { issue = "$${{ inputs.issue }}", text = "$${{ inputs.body }}" }
          auth   = { oauth2 = { connection = true } }
        }
      }
    }
  }
}

Replace <client id> with the client ID that the service gave your OAuth app, and ACME_CLIENT_SECRET with the name of the secret that holds its client secret. Bind the secret to the host of token: Spotlight sends the client secret only to a token endpoint the secret is bound to. For a public client, which has no secret, leave out secret.

identity is optional. It reads the service's token response and names the account Spotlight shows once connected; point it at whatever field your service returns.

If the service joins scopes with commas, set scopeSeparator = ",". If the service's app does not take PKCE, set pkce = false. See Connection.

If the integration's tools should act as the person who started each task, set actsAs = "requester" in connection. A hook cannot call these tools.

If the service asks which resource the access is for, set resource to its address.

Run terraform apply.

Use another OAuth client

Without client, Spotlight uses the first client it has of these. A remote MCP server whose connection has discover = true takes no client, and uses these too.

  • The deployment's client for the integration's integration name, in OAUTH_CLIENTS. For a discovered server, that client must also name the issuer of the server's authorization server; see Discovery.
  • A client that the service registers on request. A discovered server names its registration endpoint itself. Otherwise, set registration to the service's client registration endpoint:
    connection = {
      actsAs = "requester"
      oauth2 = {
        authorize    = "https://acme.example/oauth/authorize"
        token        = "https://acme.example/oauth/token"
        registration = "https://acme.example/oauth/register"
        resource     = "https://api.acme.example"
        scopes       = ["issues:write"]
      }
    }

Run terraform apply.

Connect the team

Open Settings from the workspace menu, then Integrations under the team's name. The integration's row reads "Acts as the team".

Select Connect team account on the row. The button reads Opening… and then takes you to the service.

Sign in at the service if it asks, and approve the access it lists. Do this within 10 minutes, in the same browser, while still signed in to Spotlight as yourself.

The service sends you back to the team's Integrations page. Open the row: Team account shows the account the service named, or "Connected" if the integration has no identity. Requests that use auth = { oauth2 = { connection = true } } now carry the team's access token.

A member who is not an owner or admin sees "Waiting for an admin" on the row instead of the button.

Connect yourself

For an integration with actsAs = "requester":

Open Settings from the workspace menu, then Integrations under the team's name. The integration's row reads "Acts as each person".

Select Connect your account on the row, then sign in and approve at the service as above.

The service sends you back to Integrations. Open the row: Your account shows the account the service named, or "Connected". From then on its tools act as you on the tasks you start. To stop that, open the actions menu beside your account and select Disconnect.

An owner or admin also sees People: who has connected, and under "Not connected", the team's members who have not, never their tokens. Nobody can disconnect someone else.

Answer a request to connect

If a run on a task you started calls a tool that acts as you, and you have not connected the integration, or the service could not refresh your connection, nothing is sent. The task is assigned to you and your inbox gets an item saying which tool needs your connection. Select Connect in it and authorize at the service. Once you are back, the item is answered with Connected <Name>. and the work resumes.

For what happens when there is nobody to ask, see Acts as.

Reconnect

To connect a different account, or after the service revoked Spotlight's access, open the actions menu beside Team account and select Change account, or for your own, select Disconnect and then Connect your account, and authorize again. The new connection replaces the old one.

Team account shows why a connection stopped working:

ShownWhyWhat to do
Made through another OAuth appThe definition's connection.oauth2.client.id changed after the team connected.Select Connect team account.
Token refresh failedThe service did not refresh the token.Select Connect team account.

If it does not connect

If you select Connect team account or Connect your account and a message at the bottom of the page says it failed instead of taking you anywhere, Spotlight would not begin. Find the message:

MessageWhat to change
Only a workspace owner or admin can connect a team account.Ask an owner or admin of the workspace to connect the team.
Integration <integration> doesn't take a personal account.The integration acts as the team. Connect the team with Connect team account instead.
Secret <NAME> not found. Please create it first.Create the secret that client.secret names, or correct the name.
Secret <NAME> is not bound to <origin>.Bind the secret that client.secret names to the host of token.
Integration <integration> has no OAuth2 client.Add client to the definition. See Declare the connection.
Integration <integration> has no OAuth2 client for its authorization server.Give the deployment's client the issuer of the server's authorization server. See Discovery.
Outbound call to <host> blocked., then a reasonAllow the host in the deployment's or the workspace's outbound list. See Calls out of Spotlight.
OAuth2 endpoints for integration <integration> not found.Check what the MCP server publishes. See Discovery.
Client registration for integration <integration> failed.Check the service's registration endpoint. See Client registration.

For every message, see Begin errors.

If you authorized at the service but land on Spotlight's start page instead of the page you started from, the connection failed, and Spotlight shows no message. Check that:

  • you may make the connection: the team's needs an owner or admin of the workspace, and your own needs you to be on the team;
  • you came back within 10 minutes of starting to connect;
  • you did not sign in to Spotlight as someone else in the meantime;
  • you approved the request at the service rather than declining it.

Then select Connect again. If it fails every time, the service may be rejecting the client or its redirect URL. Check that the OAuth app at the service names the redirect URL https://app.usespotlight.ai/api/integrations/oauth/callback, and that the definition's client names its client ID and client secret. For a client in OAUTH_CLIENTS, whoever runs your Spotlight deployment can check it.

On this page