Skip to main content

Overview

ClypAI uses Better Auth for authentication, providing secure user authentication, session management, and organization access control. All authentication endpoints are accessible at:
https://clypai.com/api/auth
Better Auth handles authentication automatically when using the ClypAI web interface. The information below is for developers integrating with ClypAI or building custom authentication flows.

Authentication Methods

ClypAI supports multiple authentication methods:

Email and Password

1

Sign Up

Create an account using email and password. Email verification is required.Note: Sign-ups may be restricted during beta. Check the waitlist if you can’t create an account.
2

Verify Email

Check your email for a verification code sent via Resend.
3

Sign In

Use your verified email and password to sign in.

GitHub OAuth

Authenticate using your GitHub account:
  1. Click Continue with GitHub on the sign-in page
  2. Authorize ClypAI to access your GitHub profile
  3. Your account will be created or linked automatically
GitHub OAuth may be disabled during beta periods to control access.

Waitlist System

ClypAI uses a waitlist system for controlled access:

Joining the Waitlist

If sign-ups are closed, you can join the waitlist:
  1. Visit clypai.com
  2. Click Join Waitlist
  3. Provide your email and details
  4. You’ll receive a confirmation email
Waitlist Configuration:
  • Maximum participants: 1,000
  • Rate limit: 5 attempts per 10 minutes
  • Notifications: Email on join, accept, or reject

Checking Waitlist Status

You can check your position and status via email notifications sent through Resend.

Organization Management

Upon signup, ClypAI automatically creates a personal organization for each user.

Creating Organizations

Organizations are created automatically using the Better Auth organization plugin:
const organization = await auth.api.createOrganization({
  body: {
    userId: user.id,
    name: `${user.name}'s Organization`,
    slug: random, // 8-character random ID
  },
});

Setting Active Organization

Switch between organizations:
await auth.api.setActiveOrganization({
  body: {
    organizationId: organization.id,
  },
  headers: await headers(),
});

Session Management

Better Auth handles session management with secure tokens:
  • Sessions are HTTP-only cookies
  • Automatic session refresh
  • Secure token storage
  • CSRF protection included

Getting Current Session

Server-side session retrieval:
import { auth } from "@/lib/auth";
import { headers } from "next/headers";

const session = await auth.api.getSession({
  headers: await headers()
});

Pricing Integration

ClypAI integrates Better Auth with Polar for subscription management:
  • Product ID: 3ec54eb9-420c-433f-9500-bf36e2f65f4a (Pro plan)
  • Checkout: Available for authenticated users only
  • Customer creation: Automatic on sign-up
  • Usage tracking: Enabled via Polar plugin

Security Best Practices

Always use HTTPS when communicating with ClypAI authentication endpoints. Better Auth enforces secure connections.
ClypAI accepts authentication requests from:
  • https://clypai.com
  • https://*.clypai.com
  • https://*.clyp.ai
  • Vercel preview deployments
  • Sessions are HTTP-only cookies
  • Sessions expire automatically
  • No session data stored in localStorage
  • CSRF tokens protect against cross-site attacks
All email/password accounts require email verification via Resend before accessing the platform.

Environment Variables

ClypAI authentication requires these environment variables:
BETTER_AUTH_SECRET
string
required
Secret key for Better Auth encryption and signing
BETTER_AUTH_URL
string
required
Base URL for Better Auth callbacks (e.g., https://clypai.com)
DATABASE_URL
string
required
PostgreSQL connection string for user and session storage
GITHUB_CLIENT_ID
string
GitHub OAuth application client ID (if GitHub auth is enabled)
GITHUB_CLIENT_SECRET
string
GitHub OAuth application client secret (if GitHub auth is enabled)
RESEND_API_KEY
string
required
Resend API key for sending email verifications and waitlist notifications
POLAR_ACCESS_TOKEN
string
required
Polar API token for subscription management
POLAR_SUCCESS_URL
string
Redirect URL after successful Polar checkout

Database Schema

Better Auth stores authentication data in PostgreSQL:
  • users - User accounts and profiles
  • sessions - Active user sessions
  • organizations - Organization data
  • organization_members - Organization membership
  • waitlist - Waitlist entries and status

API Keys (Planned)

API key authentication for programmatic access is planned for the full 2026 launch. Currently, authentication is session-based via Better Auth.
When available, API keys will:
  • Provide programmatic access to ClypAI
  • Support separate development and production keys
  • Include scoped permissions for fine-grained access
  • Be manageable via the ClypAI dashboard

Admin Access

The Better Auth admin plugin provides administrative capabilities:
  • User management
  • Organization oversight
  • Session monitoring
  • Waitlist approval/rejection
Admin access is restricted to authorized ClypAI team members.

Next Steps

Sign Up

Create your ClypAI account

Join Waitlist

Get early access when available

Better Auth Docs

Learn more about Better Auth

Support

Get help with authentication

Troubleshooting

  • Check spam/junk folder
  • Verify email address is correct
  • Wait a few minutes and try resending
  • Contact support if issue persists
  • Ensure you’re using a verified GitHub account
  • Check if GitHub OAuth is enabled (may be disabled during beta)
  • Try clearing cookies and signing in again
  • Sign in again to create a new session
  • Sessions expire after a period of inactivity
  • Close and reopen your browser if issues persist

For questions about authentication or account access, visit our support page.

Build docs developers (and LLMs) love