Skip to main content
Before using the chat SDK, you need to authenticate users. Pick one of two approaches:

Company-scoped user tokens

Use this approach if your app already has its own users (via your own auth / session system). You keep your existing login flow and mint a Whop token for whichever user is currently signed in — no extra sign-in step. Your server exchanges your Whop API key for a short-lived user token on demand and returns it to the client. You decide which user the token is for.

1. Gather your credentials

You’ll need three things:
  1. API key — create one at the Whop Developer Dashboard. Treat it like a password and keep it on your server only.
  2. Company ID — find it in your dashboard URL: whop.com/dashboard/biz_XXXXXXXXX/.
  3. User ID — the user you want to authenticate. In production, derive this from your own auth / session system.
For embedded chat, both company_id and user_id are required together when minting a token.

2. Create a token endpoint on your server

Add an endpoint that calls POST https://api.whop.com/api/v1/access_tokens with your API key and returns the resulting token to the client.
app/api/chat/token/route.ts

3. Fetch the token from your app

Provide the SDK with a token callback that fetches from your endpoint. The chat elements call this whenever they need to authenticate, and again automatically when the token expires.

Required scopes

Request these scopes when creating the token:
If your app owns the user accounts and mints company-scoped chat tokens, sync those users before passing their user_id here. User syncing is not part of OAuth.

Sync your users

Create or map Whop users before minting company-scoped chat tokens.

OAuth

OAuth lives on its own page so this guide can stay focused on company-scoped user tokens. Use OAuth when your app wants users to sign in to Whop themselves through a sign-in page or iOS webview. This is the right choice when your app needs access to a user-owned Whop account, or when you do not want your backend to mint Whop user tokens.

OAuth

Set up OAuth scopes, redirect URIs, web token endpoints, and SDK-managed OAuth on iOS.