Skip to main content

Instantiating Mesh

To initialize Link within your application, the first step is to call the Link Token endpoint. This endpoint provides a short-lived (30 minute), one-time-use token for initializing a Link session using our client-side SDKs.

Step 1: Invoking Mesh Modal Catalogue

The most basic way to initialize Link is to simply pass the userId body param. The userId is a unique ID representing the end user. This identifier is a map to reference which customers you are logging in through Mesh Link

Go ahead and click button below:

In this demo, we call the Link Token endpoint, including a userId and passing then call linkToken.openLink() function in Web SDK. Once the first session is complete, Link will render a Continue button (which will close the Modal) or allow you to link another account.

Checkout the example request used for the demo:

curl --request POST \
--url https://integration-api.meshconnect.com/api/v1/linktoken \
--header 'accept: application/json' \
--header 'content-type: application/*+json' \
--data '{"userId":"12345"}'
Forcing one login only

By default, Mesh Link lets users authenticate with more than one provider in one Link session. This is great for portfolio management use cases or when a user wants to transfer from one provider to another within your application. To limit the authentication to one provider, set the restrictMultipleAccounts param to false.

curl --request POST \
--url https://integration-api.meshconnect.com/api/v1/linktoken \
--header 'accept: application/json' \
--header 'content-type: application/*+json' \
--data '
{
"userId": "12345",
"restrictMultipleAccounts": true
}
'

Step 2a: Invoking Mesh Modal directly to defiWallet

Many of our customers and UI/UX designers want to load up Link with their buttons and skip our Full Catalogue. This is easily achieved passing the integrationId of Exchange/Broker or Defi Wallet.

In this demo, we have a custom drop down menu to let the user choose the Wallet they want to connect to

tip
  • Skipping Mesh Catalogue allows you to use unique buttons on the front end for popular wallets.
  • You will need to call Get API Status to get the individual identifiers for the wallets integrationId. Storing a copy or fetching in realtime are viable options

Example Request:

curl --request POST \
--url https://integration-api.meshconnect.com/api/v1/linktoken \
--header 'accept: application/json' \
--header 'content-type: application/*+json' \
--data '
{
"userId": "12345",
"restrictMultipleAccounts": true,
"integrationId":"34aeb688-decb-485f-9d80-b66466783394" //metamask identifier
}

Step 2b: Invoking Mesh Modal directly to Broker or Exchange

Using the same Integrations endpoint, to fetch the integration Id, we'll use an Exchange identifier to open Coinbase

You can programmatically obtain the integrationId value by calling our /api/v1/integrations endpoint or by accessing it in the Integrations tab.

In this demo, Mesh Link will skip the catalog and take the user directly to the provider login screen

Example Request:

curl --request POST \
--url https://integration-api.meshconnect.com/api/v1/linktoken \
--header 'accept: application/json' \
--header 'content-type: application/*+json' \
--data '
{
"userId": "12345",
"integrationId": "47624467-e52e-4938-a41a-7926b6c27acf " //coinbase id
}
'

Click Next