@nangohq/frontend.
Instantiate the frontend SDK
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.Connect using the headless client
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.
Error Handling
The Nango Frontend SDK may throw different types of errors during authentication and connection setup. Below is a list of all possible error types along with their meanings:-
missing_auth_token- Occurs when neither a public key nor a connect session token is provided.
- Message: βYou must specify a public key OR a connect session token (cf. documentation).β
-
blocked_by_browser- Occurs when the browser blocks the popup window for authentication.
- Message: βModal blocked by browserβ
-
invalid_host_url- Occurs when the provided host URL is invalid.
- Message: βInvalid URL provided for the Nango host.β
-
missing_credentials- Occurs when required credentials are not provided.
- Message: βYou must specify credentials.β
-
window_closed- Occurs when the authentication window is closed before completing the flow.
- Message: βThe authorization window was closed before the authorization flow was completedβ
-
connection_test_failed- Occurs when credential verification fails for certain integrations before the connection is established.
- Message: βThe given credentials were found to be invalid. Please check the credentials and try again.β
-
missing_connect_session_token- Occurs when attempting to reconnect without a session token.
- Message: βReconnect requires a session tokenβ
-
resource_capped- Occurs when the resource usage limit has been reached.
- Message: βReached maximum number of allowed connections for your planβ or βReached maximum number of connections with functions enabledβ
-
unknown_error- Occurs when an unexpected error happens that doesnβt fall into other error categories.
- Message: Varies depending on the underlying error (e.g., network failures, unexpected exceptions)
Error Response Structure
All errors from the Nango Frontend SDK follow this structure:Handling Errors
You can handle these errors in your code using theAuthError class.