Use Nango as a Credential Store
Copy page
Nango is an excellent choice for both development and production environments, particularly when working with OAuth2.1/PKCE flows and complex integrations.
To get started, first set up Nango either through cloud or local deployment, then create your credential, and finally consume the credential through the TypeScript SDK.
Nango setup option 1: Nango Cloud
Step 1: Create a Nango account
Sign up here.
Step 2: Save your Nango secret key
After creating your Nango account, navigate to Environment Settings in your dashboard and copy the secret key.
Step 3: Configure your root .env file
Restart your dev server to load the new environment variable:
Step 4: Create a new credential in the Visual Builder using Nango
Video walkthrough available
Follow along with our visual guide to see each step in action.
Nango setup option 2: Nango local
Automated Setup (Recommended)
Run pnpm setup-dev first to set up core databases and migrations. setup-dev:optional only starts optional services.
Run the following from your project root:
This:
- Clones
agents-optional-local-devinto.optional-services/if not already present - Starts Nango, SigNoz, OTEL Collector, and Jaeger via Docker Compose
- Generates a Nango secret key and writes it to your
.env(re-uses an existing key if already set) - Sets
NANGO_SERVER_URL,PUBLIC_NANGO_SERVER_URL, andPUBLIC_NANGO_CONNECT_BASE_URL
Restart your dev server after setup completes:
Then create a credential in the Visual Builder using Nango Store.
Video walkthrough available
Follow along with our visual guide to see each step in action.
Use pnpm optional:status to check service health, pnpm optional:stop to stop optional services, or pnpm optional:reset to start fresh.
Manual Setup
If you prefer manual setup:
Step 1: Clone the optional services repository
Step 2: Configure the .optional-services/.env
Nango requires an encryption key for credential storage. Create the .env from the template:
NANGO_ENCRYPTION_KEY cannot be changed without losing existing encrypted data.Step 3: Start Nango Services
Inside .optional-services, start Nango:
Step 4: Save your Nango secret key
- Open Nango at
http://localhost:3050 - Navigate to Environment Settings and copy the secret key
Step 5: Configure your root .env file
In your root project directory (not inside .optional-services/), update your .env file:
Restart your dev server:
Step 6: Create a credential in the Visual Builder
Create a credential in the Visual Builder using Nango Store.
Video walkthrough available
Follow along with our visual guide to see each step in action.
Referencing credentials in SDK
Once you have created a credential in the Visual Builder, you can reference it in the TypeScript SDK for both Bearer Authentication and OAuth2.1/PKCE.
Here is an example of how to reference a credential in the TypeScript SDK for both Bearer Authentication and OAuth2.1/PKCE.
Credential Configuration
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Unique identifier for the credential |
type | CredentialStoreType | Yes | Type of credential store (memory, nango, or keychain) |
credentialStoreId | string | Yes | Identifier for the specific credential store instance |
retrievalParams | object | Yes | Parameters for retrieving the credential from the store. |