Security model
Keeprgl_test_ and rgl_live_ API keys on your backend only. Never put them in browser code, mobile apps, or client-side environment variables.
Connect uses short-lived browser tokens:
- your backend creates a
link_tokenwithX-API-Key - your browser opens the hosted modal with that
link_token - the hosted modal returns a one-use
public_token - your backend exchanges the
public_tokenfor the persistentconnection_id
fetchLinkToken so your button can open Connect without exposing your API key. fetchLinkToken should call your own backend endpoint, and that endpoint should call Rangler with X-API-Key.
Flow
- Your backend creates a short-lived link token with
X-API-Key. - Your frontend opens the hosted Connect modal with
@rangler/connect-js. - The hosted modal links the customer to an enabled institution and returns a one-use
public_token. - Your backend exchanges the public token for a persistent
connection_id. - Your backend reads accounts, positions, and transactions through the Connect API.
Create a link-token endpoint
Create this endpoint in your own backend. It authenticates your current user, maps that user to a stableclient_user_id, and calls Rangler with your server-side API key.
link_token, link_token_id, request_id, and expiration.
Generate a new Idempotency-Key for each logical link-token request. Reuse it only when retrying the same body after a timeout or transport failure. Rangler returns the same unused, unexpired token for a valid replay. Reusing the key with a different body, or after that token is used or expired, returns 409 Conflict.
Open the hosted modal
Use the npm package when your app has a build system.linkToken directly if your app already fetched one before rendering the button.
For plain HTML or apps that do not use npm, load the hosted script tag. This uses the same token model: the script calls your backend for a link token and sends the public token back to your backend for exchange.
Define window.RanglerConnect.onLoad before the async script loads; otherwise the SDK may load before your callback is registered.
Create an exchange endpoint
Create this endpoint in your own backend. It receives the one-usepublic_token from the browser and exchanges it with your server-side API key.
connection_id, not the public token.
Read linked data
/v1/connect/connections/v1/connect/connections/{connection_id}/accounts/v1/connect/connections/{connection_id}/positions/v1/connect/connections/{connection_id}/transactions
Webhooks
Subscribe to Connect events from the portal:connect.connection.createdconnect.connection.updatedconnect.connection.revokedconnect.sync.completedconnect.sync.failedconnect.item.login_required