Skip to main content
With OAuth, users sign in to Whop themselves through a sign-in page or an iOS webview. Your app receives Whop user tokens that can authenticate embedded chat and act on behalf of the signed-in user. Use OAuth when your app needs access to the user’s Whop account, or when you don’t want to mint company-scoped user tokens from your own backend.

Full OAuth guide

See the general OAuth guide for the complete OAuth 2.1 + PKCE flow, token exchange, refresh, and revocation details.

Setup

Use the Create App endpoint to create an OAuth app programmatically:
Update redirect URIs later with the Update App endpoint.

Required scopes

Your OAuth configuration should include these scopes:

Web token endpoint

Your server needs to provide a token endpoint that returns a valid OAuth token with the required scopes. The React and vanilla JavaScript chat elements call this function whenever they need to authenticate.
See the OAuth guide for implementing the server-side token exchange.

Software development kit-managed OAuth on iOS

Call configureWithOAuth on app launch. The SDK handles the entire flow: showing a sign-in webview, obtaining tokens, and refreshing them automatically.
By default, the SDK uses your bundle identifier for the redirect URI (com.yourapp.bundle://oauth/callback). You can customize this:
Make sure the redirect URI matches what you configured in the Whop Dashboard > Developer > App > OAuth. When a user navigates to a chat view, the SDK automatically triggers the OAuth flow if they’re not already authenticated. You can also trigger sign-in and sign-out manually:

Tracking authentication state

Use the .whopAuthState modifier to reactively track whether the user has signed in:

Pre-filling tokens

If you already have the user’s Whop tokens from another source, you can pre-fill them to skip the sign-in webview on first launch. Sources include a web OAuth flow or tokens synced from your backend. This is optional and only relevant if your users have already authenticated with Whop elsewhere.
The SDK extracts the token expiration from the JSON Web Token (JWT) and handles refresh automatically. If the SDK can’t refresh expired pre-filled tokens, the normal OAuth flow starts.

Next steps

Authentication

Compare OAuth with company-scoped tokens for embedded chat.

General OAuth guide

Implement the full OAuth flow, token exchange, refresh, and revocation.

Chat element

Learn the props, events, styles, and deeplinking options for the chat UI.

Embedded chat quickstart

Render your first embedded chat experience.