@nangohq/frontend.
Instantiate the frontend SDK
Copy
Ask AI
import Nango from '@nangohq/frontend';
let nango = new Nango({ publicKey: '<PUBLIC-KEY>' });
Show child attributes
Show child attributes
Hide options
Hide options
Get your public key in the environment settings of the Nango UI. This is key is not sensitive.
Omitting the host points to Nango Cloud. For local development, use
http://localhost:3003. Use your instance URL if self-hosting.For self-hosted instances only to specify a customs path for the WebSocket connection.
Specify a specific width for the OAuth authorization modal.
Specify a specific height for the OAuth authorization modal.
Print additional console logs to debug authorization issues.
Collect & store end-user credentials
You store end-user credentials with thenango.auth method. It creates a connection in Nango.
- OAuth
- API Key
- Basic Auth
For OAuth, this will open a modal to let the user log in to their external account.
Copy
Ask AI
const result = await nango.auth('<INTEGRATION-ID>', '<CONNECTION-ID>').catch((error) => {
...
});
For API key authorization, pass the end-user’s previously-collected API key directly in the parameters.
Copy
Ask AI
const result = await nango.auth('<INTEGRATION-ID>', '<CONNECTION-ID>', {
credentials: { apiKey: '<END-USER-API-KEY>' }
}).catch((error) => {
...
});
For Basic Auth, pass the end-user’s previously-collected username & password in the parameters.
Copy
Ask AI
const result = nango.auth('<INTEGRATION-ID>', '<CONNECTION-ID>', {
credentials: { username: '<END-USER-API-KEY>', password: '<END-USER-PASSWORD>' }
}).catch((error) => {
...
});
Show child attributes
Show child attributes
The integration ID that you can find in the integration settings on the Nango UI.
The connection ID that you can find in the Connections tab on the Nango UI.
Hide options
Hide options
Specify additional connection configuration necessary to perform the authorization request.
HMAC key to secure the authorization flow (cf. (instructions)[TODO]).
If
true, nango.auth() would fail if the login window is closed before the authorization flow is completed.For OAuth, specify the query parameters of the authorization URL.
For Slack OAuth, specify user-specific scopes.
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Questions, problems, feedback? Please reach out in the Slack community.