Install Auth SDK
Learn how to configure the Wristband SDK for your Express application.
After setting up Express, you'll need to install and configure the Wristband ExpressJS SDK. We'll be using this SDK throughout the quickstart guide to help facilitate the integration between your application and Wristband.
Installation
Install the Wristband Auth SDK using your preferred package manager CLI:
npm install @wristband/express-auth
yarn add @wristband/express-auth
pnpm add @wristband/express-auth
Configuration
Prerequisites
Before you can configure the Wristband SDK, you'll need to make sure you have the following values that were generated or specified when you set up your Wristband application:
-
wristbandApplicationVanityDomain - This is the vanity domain of your application. To find this value, select your application from the Dashboard Home Page. On the "Application Settings" page, you'll see the "Application Vanity Domain" field in the top info box.
-
clientId - This is the ID of the OAuth2 Client that was created as part of the application setup process. To find this value, select your application from the Dashboard Home Page. In the left navigation bar, select "OAuth2 Clients" and then select the client you created earlier. The client ID will be present in the top info box.
-
clientSecret - This is the secret of the OAuth2 Client that was created as part of the application setup process. The client's secret is only shown when the client is first created. If you don't remember the secret that was initially generated for the client, you can rotate the secret to create a new one. To rotate the client's secret, select "OAuth2 Clients" from the left navigation bar, and then select the client whose secret you'd like to rotate. On the client page, scroll down to the "Client Secret Settings" section and then select the "Rotate" button. Your client's new secret will be presented in a modal.
Configure The SDK
Create an instance of WristbandAuth
in the source root directory of your Express project (e.g.src/wristband-auth.ts
). Update the AuthConfig
properties with the values mentioned in the above sections.
// wristband-auth.ts
import { createWristbandAuth } from '@wristband/express-auth';
const authConfig = {
clientId: '<your-client-id>',
clientSecret: '<your-client-secret>',
wristbandApplicationVanityDomain: '<your-application-vanity-domain>',
};
export const wristbandAuth = createWristbandAuth(authConfig);
Updated 10 days ago
Next, you'll use the Wristband SDK to create the necessary authentication endpoints in your Express server.