Typescript sdkCredentials

Nango

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

NANGO_SECRET_KEY=your_nango_secret_key

Restart your dev server to load the new environment variable:

pnpm dev

Step 4: Create a new credential in the Visual Builder using Nango

Nango setup option 2: Nango local

Step 1: Clone the optional services repository

git clone https://github.com/inkeep/agents-optional-local-dev
cd agents-optional-local-dev

Step 2: Start Nango Services

Inside the agents-optional-local-dev repository, run the following command:

docker-compose --profile nango up -d

Step 3: Save your Nango secret key

  1. Open Nango at http://localhost:3050
  2. Navigate to Environment Settings and copy the secret key

Step 4: Configure your root .env file

In your root project directory (not inside the agents-optional-local-dev repository), update your .env file:

NANGO_SECRET_KEY=your_nango_secret_key
NANGO_HOST=http://localhost:3050
PUBLIC_NANGO_CONNECT_BASE_URL=http://localhost:3051

Restart your dev server to load the new environment variables:

pnpm dev

Step 5: Create a new credential in the Visual Builder using Nango

Create a new credential in the Visual Builder using Nango Store as the credential store.

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

ParameterTypeRequiredDescription
idstringYesUnique identifier for the credential
typeCredentialStoreTypeYesType of credential store (memory, nango, or keychain)
credentialStoreIdstringYesIdentifier for the specific credential store instance
retrievalParamsobjectYesParameters for retrieving the credential from the store.