Before you start
You need:- a Mono application
- its public key for the browser
- its secret key stored only on your backend
- Node.js 10 or later
1. Install Connect.js
2. Create the widget
For a new customer, pass a name and email. If the customer already exists in Mono, pass{ id: "CUSTOMER_ID" } instead.
setup() mounts the widget but keeps it hidden. Create the instance once for the lifetime of the page or component.
3. Open the widget from a user action
4. Send the auth code to your backend
After account linking,onSuccess receives an object containing code. Forward that code to your backend.
5. Exchange the code on your backend
The backend calls Mono’s token-exchange endpoint with the secret key. The example below is framework-neutral server code.Confirm the integration
The first account-linking path is complete when:setup()has mounted the hidden widget.- A user action calls
open(). onSuccessreceives{ code }after linking.- Your backend exchanges the code.
- Your application stores the returned Mono account ID.
Continue
Framework guides
Adapt the lifecycle to React, Angular, or Next.js.
Events
Instrument the widget lifecycle without treating events as success confirmation.
Reauthorization
Reconnect a linked account with its account ID.
Troubleshooting
Diagnose setup, key, callback, and exchange failures.