# OAuth Connectors Overview

Connect third-party services to your workflows using OAuth 2.0.

JsWorkflows lets you connect external services using OAuth 2.0. Once connected, your workflows can call those services' APIs without manually storing tokens in workflow code. JsWorkflows stores the connection tokens and refreshes access tokens automatically when the provider supports refresh.

For Google, the same OAuth handle can also be used by the built-in file pickers in template settings and in **Manage Environment Variables**. That lets users select a Google Sheet, Doc, or Drive folder in the UI and then use the saved file reference in workflow code.

## Connecting a service

OAuth connections in JsWorkflows are created first, then referenced later by a **handle** in workflow code, templates, or picker-enabled UI fields.

You can open the OAuth section in either of these places:

1. **Settings → OAuth2 Tokens**
2. From the workflow code editor:
   - open **More actions**
   - select **Manage OAuth2 tokens**

Then:

1. Click **Connect to Service**
2. Choose the service
3. Complete the provider's OAuth flow
4. Save the connection with a **handle**, a short name you use later in workflow code

Handles should use lowercase letters, numbers, and hyphens only.

## Using a connection in a workflow

Call `api.getOAuthToken(handle)` to get a valid access token, then use it with the global `fetch()`:

```js
const { token, error } = await api.getOAuthToken('my-google');
if (error || !token) { console.log('OAuth error:', error); return; }

const response = await fetch('https://www.googleapis.com/drive/v3/files', {
  headers: { 'Authorization': `Bearer ${token}` },
});
```

## Platform-managed connections

For the following services, JsWorkflows manages the OAuth app credentials. You only need to log in, no Client ID or Client Secret required:

- Google (Drive-based access for Sheets, Docs, and Drive picker flows)
- Slack
- Microsoft
- Dropbox
- GitHub
- Mailchimp
- HubSpot
- Notion

Custom OAuth providers are configured separately. See [Custom OAuth](/oauth/custom/) when you need to connect a service that is not in the platform-managed list.

## Supported services

| Service | Doc |
| --- | --- |
| Google | [Google OAuth](/oauth/google/) |
| Slack | [Slack OAuth](/oauth/slack/) |
| Microsoft | [Microsoft OAuth](/oauth/microsoft/) |
| HubSpot | [HubSpot OAuth](/oauth/hubspot/) |
| GitHub | [GitHub OAuth](/oauth/github/) |
| Dropbox | [Dropbox OAuth](/oauth/dropbox/) |
| Mailchimp | [Mailchimp OAuth](/oauth/mailchimp/) |
| Notion | [Notion OAuth](/oauth/notion/) |
| Shopify (custom app / secondary store) | [Shopify Custom App](/oauth/shopify/) |
| Custom (any OAuth 2.0 provider) | [Custom OAuth](/oauth/custom/) |

## Google note

Google is slightly different from some other OAuth connectors.

The current Google file flow is documented around:

- one saved Google OAuth handle
- `drive.file`
- optional Google file pickers in:
  - template settings
  - Manage Environment Variables

If you plan to work with Google Sheets, Google Docs, or Google Drive files from JsWorkflows, read the dedicated [Google OAuth](/oauth/google/) page for the current setup and examples.