| Approach | Best for |
|---|---|
| Company-scoped user tokens | Apps that already have their own users. Your server mints Whop tokens for them — no sign-in needed. |
| OAuth | Apps that want users to sign in to Whop themselves via a sign-in page or webview. |
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:- API key — create one at the Whop Developer Dashboard. Treat it like a password and keep it on your server only.
- Company ID — find it in your dashboard URL:
whop.com/dashboard/biz_XXXXXXXXX/. - 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 callsPOST https://api.whop.com/api/v1/access_tokens with your API key and returns the resulting token to the client.
- Next.js
- Express
- cURL
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.- React
- Vanilla JS
- Swift
Required scopes
Request these scopes when creating the token:| Scope | Purpose |
|---|---|
chat:message:create, chat:read | Channels |
dms:read, dms:message:manage, dms:channel:manage | Direct messages |
support_chat:read, support_chat:message:create | Support chats |
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.

