Trigger authorization flows in your frontend with this SDK. It is available on NPM as @nangohq/frontend.

Instantiate the frontend SDK

import Nango from '@nangohq/frontend';

const nango = new Nango({ connectSessionToken: '<CONNECTION-SESSION-TOKNE>' });

Parameters

Connect using Nango Connect UI

Nango provides a UI component that guides your app’s users through automatically and securely setting up an integration. This UI is hosted on Nango’s servers and requires minimal setup on your end to get started quickly. This is the recommended way to use Nango in your frontend.

const connectUI = nango.openConnectUI({ sessionToken: 'SESSION_TOKEN' });

Parameters

Response

Connect using the headless client

You store end-user credentials with the nango.auth method. It creates a connection in Nango.

For OAuth, this will open a modal to let the user log in to their external account.

const result = await nango.auth('<INTEGRATION-ID>').catch((error) => {
...
});

Parameters

Success response

Error response

By default we are auto generating the connectionId which is the unique identifier of this connection but ou can also specify it like this:

const result = await nango.auth('<INTEGRATION-ID>', '<CONNECTION-ID>');

Questions, problems, feedback? Please reach out in the Slack community.