Before you start
- You’ve set up
onIntegrationConnectedcallback to captureaccessTokensobject (see Use Mesh’s callback functions)
Overview
Mesh’s Managed Token system (MMT) simplifies how you manage user authentication tokens. MMT securely stores and manages token lifecycles on your behalf, giving you a persistenttokenId for each connected user account. You can use this to create a seamless return-user experience for exchanges and to interact with certain Mesh APIs — no manual token refresh or re-authentication required.
Benefits
- Streamlined UX: After connecting their exchange account to your app, users can skip repetitive authentication steps on future visits.
- Persistent Access: Mesh handles all token refresh logic. For exchanges with long-lived tokens (like Coinbase), access stays valid indefinitely. For those with expiring tokens (like Binance), users will be prompted to re-authenticate when needed — but the
tokenIdyou store never changes, so no backend updates are required on your part. - Integration-Agnostic: Works across different auth methods (OAuth, credentials-based) with no added client-side complexity.
How to Implement MMT
1. Obtain a tokenId
When a user authenticates with their exchange or wallet account, you will receive the SDK onIntegrationConnected event, which contains an object like this:
tokenId and brokerType.
2. Build the accessTokens object
See the Use Mesh’s callback functions guide for more information on how to use the onIntegrationConnected callback function to do this.
This will later be passed into the Mesh SDK for a returning user experience.
Notes & references:
- Store the
tokenIdsecurely, for example in a database. Make sure eachtokenIdandbrokerTypepair is clearly tied to theuserIdthat connected the account. - You’ll notice that the
tokenId&accessTokenin theintegrationConnectedevent are the same for the initial connection of a particular user account. But if theaccessTokenis ever refreshed or replaced, they will diverge. Link facilitates the user experience, and Mesh manages the token refresh logic for you, which means thetokenIdwill remain unchanged for a givenuserId+brokerTypecombination. This means you should put thetokenIdvalue from the SDK event into theaccessTokenfield in this object. - The
brokerName,accountId, andaccountNamefields are obsolete but must still be passed (can be empty) when initializing the SDK.
3. Pass the accessTokens object into the Mesh SDK

Web SDK Example
Web SDK Example

iOS SDK Example
iOS SDK Example

Android SDK Example
Android SDK Example

React Native SDK Example
React Native SDK Example

Flutter SDK Example
Flutter SDK Example
Token Lifecycle and Behavior
| Scenario | Result |
|---|---|
| Same user reconnects with same integration | Returns same tokenId |
| Different user connects to same integration | Returns a new tokenId |
| Same user connects with different scopes (e.g. read vs. write) | Returns distinct tokenId per scope |
| Write endpoint called using read-only TokenId | API returns a scope mismatch error |
| Token revoked by client (use Remove connection endpoint) | Associated access is permanently disabled and Mesh also deletes the token physically, without any way to restore it |
Supported Integrations
This list is growing and will be updated over time. As new integrations are added, you will not have to update support on your end.- Coinbase
- Binance
- Uphold
- Note: connections with self-custody wallets are maintained on subsequent sessions (unless the user actively kills the connection in their wallet app) without the need for handling tokens. This means the same smooth return user journey is achieved for wallet transactions.
Security Considerations
MMT streamlines token handling and unlocks some powerful functionality — here’s how Mesh protects the data under the hood:- Encrypted Storage: All tokens are encrypted at rest using modern encryption standards.
- Scoped Access: Each
tokenIdis tied to the permission scope (read or write) associated with the API key. Unauthorized operations (e.g., calling a write endpoint with a read-scoped token) will be rejected. - Client-Level Isolation: Each
tokenIdis also scoped to a specificclientId. Even if the same end user connects the same integration account across multiple client apps, the tokens are isolated and not shared across clients. - User-Level Isolation: Each
tokenIdis unique to a specificendUserIdand integration. - Token Revocation: Clients can revoke a
tokenId, permanently disabling access and triggering a secure deletion process. There is no path to restore a revoked token.
What’s next
Next up: Polish the experience — with the core integration working, this guide walks you through the finishing touches: a well-designed entry point, clean session handling, and webhook setup.AI coding reference (llms.txt)
AI coding reference (llms.txt)
AI coding reference — a compact summary of this page’s APIs, parameters, and patterns for use by AI coding assistants (following the llms.txt standard). Human readers can safely ignore this.llms.txt — Supercharge return-users (Mesh Managed Tokens)Use Mesh Managed Tokens (MMT) for one-tap return-user flows. Mesh manages token refresh; you store a stable
tokenId.Step 1 — Capture from onIntegrationConnected: Extract accessToken.accountTokens[].tokenId and accessToken.brokerType. Store server-side per userId + brokerType.Step 2 — Build accessTokens array:
[{ accessToken: '<tokenId>', brokerType: '<brokerType>', brokerName: '', accountId: '', accountName: '' }]Critical: put tokenId in the accessToken field (not the raw accessToken string). tokenId is stable even when the underlying token rotates.Step 3 — Pass into SDK on next session: Include accessTokens array in createLink() / LinkSettings / LinkConfiguration / MeshConfiguration.Token lifecycle: Same user + integration → same tokenId | Different user or scope → new tokenId | Revoked → permanently disabled, unrestorable | Coinbase: tokens valid indefinitely | Binance: tokens expire, user re-auths but tokenId unchanged.Supported integrations: Coinbase, Binance, Uphold (growing). Self-custody wallet connections persist without tokens.Security: Tokens encrypted at rest; scoped per clientId, endUserId, and permission scope (read vs. write).