The Link flow: create a link_token server-side, hand it to Plaid
Link in your client, then exchange the public_token Link returns
for a long-lived access_token. Store the access token encrypted and
never log it.
Values
DEFAULT_COUNTRY_CODES
DEFAULT_COUNTRY_CODES: Vec [
"US"
]
DEFAULT_LANGUAGE
DEFAULT_LANGUAGE: Str "en"
DEFAULT_PRODUCTS
DEFAULT_PRODUCTS: Vec [
"transactions"
]
Functions
build-link-token-request
fn (user-id: Str, client-name: Str, options: Map): Map
The /link/token/create body (without credentials). options are
Plaid's top-level fields: products, required_if_supported_products,
optional_products, additional_consented_products,
country_codes, language, webhook, redirect_uri,
android_package_name, access_token (update mode), user
(merged with client_user_id: legal_name, email_address,
phone_number, ...), user_id, account_filters,
transactions: {days_requested}, link_customization_name,
hosted_link, ... products defaults to ["transactions"] except
in update mode (when access_token is given); country_codes to
["US"]; language to "en". Unset fields are omitted. Exposed
for testing.
create-link-token
fn (user-id: Str, client-name: Str): Map
fn (user-id: Str, client-name: Str, options: Map): Map
fn (user-id: Str, client-name: Str, options: Map, opts: Map): Map
POST /link/token/create: start a Link session for one of your users.
user-id is your stable id for the user (client_user_id; not an
email or other PII). The 2-arity form defaults to transactions in the
US, in English; pass options for anything else (see
build-link-token-request). Returns {link_token, expiration, request_id}.
Example
link ::plaid::link/create-link-token("user-42", "My App", {
products: ["auth", "transactions"],
country_codes: ["US", "CA"],
webhook: "https://example.com/plaid/webhook",
redirect_uri: "https://example.com/plaid/oauth",
transactions: {days_requested: 730}
})
exchange-public-token
fn (public-token: Str): Map
fn (public-token: Str, opts: Map): Map
POST /item/public_token/exchange: trade Link's short-lived public_token (30 minutes, single use) for {access_token, item_id}. Persist both; the access token doesn't expire.
get-link-token
fn (link-token: Str): Map
fn (link-token: Str, opts: Map): Map
POST /link/token/get: a Link token's metadata and, for Hosted Link or multi-Item sessions, the session results (public tokens).