Skip to main content

Check A Connection

Before a long job, see if the user’s plans have room. It’s cheap: no provider call.
The Python, Go, and cURL tabs send an access token. One call makes it from the refresh token you saved, and it lasts an hour: see Refresh. The Node client makes and keeps it for you. This is also what a connections list in your app shows: connection.plans for what the user shared, and connection.manageUrl (manage_url over HTTP) for Dari’s page with its usage and limits. Each plan in connection.plans has a state: The grant itself has a state too: budget_limit when your app used its token cap, until connection.availableAt (available_at over HTTP). You don’t have to check before every request: Dari refuses a request it can’t serve and says when to retry.

Update Mode

Your user can change what they shared without connecting again. Open Link with the connection’s grant_id:
The user sees what they shared, ticked, and can add or remove plans. The same grantId and refresh token keep working, so there is nothing new to store. If they open it from another browser, they get a fresh connection instead.

Where Users Manage It

Users see every app they connected at /v1/link/connections on your gateway, in the browser they connected from: what each app shares and used, its token caps, and Disconnect. Link there with grant.manage_url.

Disconnect

Every token for that connection stops working right away.

When To Show Reconnect

A connection that is gone answers 401 with the code grant_revoked, and its refresh token answers 400 invalid_grant. The Node client throws both as a LinkError whose unlinked is true:
linkFetch is a fetch, so it returns Dari’s response instead of throwing: check it for 401 and grant_revoked the same way.