Skip to main content

Add Javascript SDK to your Front-end

First, install @membranehq/sdk NPM package:
Then, initialize the SDK with an Authentication Token:
In this example we use the test token you can find on the Settings page of your workspace.
You will need to replace it with a real authentication token later (see Authentication).
To verify that everything works, let’s open our drop-in integration UI:
In the end your basic Vue.js setup may look like this:

Dynamic Token

If it is more convenient for you to fetch token dynamically instead of providing static value, you can use fetchToken instead:
This option also automatically handles token expiration. If SDK was initialized long ago and token had time to expire, it will be automatically re-fetched before making new API requests.

SDK Reference

To see the full list of SDK methods check out the JavaScript API Reference.