Merge Link

Merge Link is a UI component that guides your app’s user through setting up an integration.

Preview of Merge Link component

Merge Link utilizes a series of token exchanges to securely authenticate your users’ integrations.

In this guide, you’ll set up the following in your application:

  1. Get a link_token to initialize a Merge Link session for your end user.

  2. Make Merge Link appear in your frontend.

  3. Swap for an account_token, which authenticates future requests to the Unified API.

Link diagram
3

Backend – Swap public token for account token

In your backend, create a request to exchange the short-lived public_token for a permanent account_token.

Important: Securely store this account_token in your database for authenticating future API requests to the Unified API regarding the end user’s data.

1import requests
2
3def retrieve_account_token(public_token, api_key):
4 headers = {"Authorization": f"Bearer {api_key}"}
5
6 account_token_url = "https://api.merge.dev/api/integrations/account-token/{}".format(public_token)
7 account_token_result = requests.get(account_token_url, headers=headers)
8
9 account_token = account_token_result.json().get("account_token")
10 return account_token # Save this in your database

Congrats on completing our onboarding guide!

Learn more about Unified API functionality in the links below