Install Auth SDK

Discover how to configure the Wristband SDK for your Nest.JS application.

Installation

Install the Wristband Auth SDK using your preferred package manager CLI:

npm install @wristband/nextjs-auth
yarn add @wristband/nextjs-auth
pnpm add @wristband/nextjs-auth

Configuration

Prerequisites

Before you can configure the SDK, you'll need to make sure you have the following values:

  • WRISTBAND_APPLICATION_VANITY_DOMAIN
  • WRISTBAND_CLIENT_ID
  • WRISTBAND_CLIENT_SECRET

These three environment variables are displayed immediately after provisioning your application via the Set Up a Wristband Application guide. If you do not have them on hand, you can locate them at any time in the dashboard by following the Manual Retrieval Guide.Initialize WristbandAuth by creating a file like src/wristband.ts in your Next.js project's source root directory, and fill in the configuration properties with your application's values.

Disabling Secure Cookies in Local Development

By default, WristbandAuth creates secure cookies to track login state, meaning they require an HTTPS connection. While most browsers make an exception for localhost over HTTP, Safari enforces stricter rules and blocks secure cookies on localhost without HTTPS.

To bypass this restriction during local development, set dangerouslyDisableSecureCookies: true in your configuration. Always remember to remove this flag or set it to false before deploying to production.

// src/wristband.ts

import { createWristbandAuth } from '@wristband/nextjs-auth';

export const wristbandAuth = createWristbandAuth({
  clientId: '<WRISTBAND_CLIENT_ID>',
  clientSecret: '<WRISTBAND_CLIENT_SECRET>',
  wristbandApplicationVanityDomain: '<WRISTBAND_APPLICATION_VANITY_DOMAIN>',
});
// src/wristband.ts

import { createWristbandAuth } from '@wristband/nextjs-auth';

export const wristbandAuth = createWristbandAuth({
  clientId: '<WRISTBAND_CLIENT_ID>',
  clientSecret: '<WRISTBAND_CLIENT_SECRET>',
  wristbandApplicationVanityDomain: '<WRISTBAND_APPLICATION_VANITY_DOMAIN>',
  dangerouslyDisableSecureCookies: true,
});


What’s Next

Next, we'll add a helper function to access user session data in your API routes and server-side rendering (SSR) functions.

Did this page help you?