This guide shows how you can let your users authorize external APIs, from inside your app. Once authorized, you will retrieve, store and refresh API key credentials so you can later perform API requests or use Nango’s syncing features.

This feature is free & unlimited on Nango Cloud.

Step 1: Set up Nango

Create a free Nango account (no credit card required): Try Nango Cloud

Open the Dashboard in your browser.

Step 2: Create an integration

On the Dashboard, go to the New Integration page and select an external API.

If the API uses API keys or Basic Auth for authentication, an info box will be displayed above the “save” button:

Just click save to create the integration.

Step 3: Store an API Key (or username/password)

Click “Auth” next to the integration to store an API Key (or username/password for Basic Auth) for this integration. Nango OAuth button

Step 4: Embed Nango in your frontend

Install @nangohq/frontend and use the code snippet from the Add New Connection page (step 3 above) to collect user credentials from your frontend (cf. Frontend SDK docs).

<CONNECTION-ID> identifies this user’s connection with the integration in Nango. We recommend using a user ID or similar for it.

Step 5: Retrieve the API Key (or username/password)

In your backend you can use our Node SDK or Connections REST API to fetch credentials (which will allow you to query the external API).

  • <INTEGRATION-ID> is the name of your integration. It is listed on the Integrations tab in the Dashboard, e.g. slack
  • <CONNECTION-ID> is the Connection ID you passed in step 4 above.

With the backend Node SDK

Check the backend Node SDK reference for more details.

Install @nangohq/node, then use:

import { Nango } from '@nangohq/node';

let nango = new Nango({ secretKey: '<SECRET-KEY>' });

let creds = await nango.getConnection('<INTEGRATION-ID>', '<CONNECTION-ID>');

With the REST API

Check the API reference for full details and an example response

Get the Secret Key from the Project Settings page.

curl --request GET \
        --url https://api.nango.dev/connection/<CONNECTION-ID>?provider_config_key=<INTEGRATION-ID> \
        --header 'Authorization: Bearer <SECRET-KEY-FROM-PROJECT-SETTINGS>'

Questions, problems, feedback?

We are happy to help! Please reach out on the Slack community, we are very active there.