86d uses Better Auth for all authentication: customer sign-in, admin sessions, and social OAuth flows. The auth system handles session cookies, role-based access control, and (whenDocumentation Index
Fetch the complete documentation index at: https://86d.app/docs/llms.txt
Use this file to discover all available pages before exploring further.
86D_API_KEY is set) SSO with the 86d.app platform. Setting up authentication correctly is one of the first things to do before going to production.
Required setup
Before your store can authenticate anyone, setBETTER_AUTH_SECRET to a cryptographically random string. This secret signs all session tokens and auth cookies.
.env:
.env
BETTER_AUTH_URL to your store’s public URL so OAuth callbacks resolve correctly:
.env
Auth endpoints
Better Auth handles all requests under/api/auth/[...all]. You do not need to configure these routes manually; they are wired up automatically.
| Endpoint | Description |
|---|---|
POST /api/auth/sign-in/email | Sign in with email and password |
POST /api/auth/sign-up/email | Register a new customer account |
GET, POST /api/auth/[...all] | OAuth callbacks, session management, SSO |
Guest shoppers
Guest shoppers do not need an account. Guest carts are tracked using aguestId cookie set automatically on first visit. When a guest completes checkout, their order is recorded against the guest ID. If they later create an account, their order history can be associated with the new account.
Social login providers
Enable social login by adding credentials for one or more OAuth providers to your.env. Any provider whose variables are absent is disabled automatically. You do not need to remove anything from your config.
| Provider | Required variables |
|---|---|
AUTH_GOOGLE_ID, AUTH_GOOGLE_SECRET, NEXT_PUBLIC_AUTH_GOOGLE_ID | |
| Twitter / X | AUTH_TWITTER_ID, AUTH_TWITTER_SECRET |
| Slack | AUTH_SLACK_ID, AUTH_SLACK_SECRET |
| Shopify | AUTH_SHOPIFY_ID, AUTH_SHOPIFY_SECRET |
| Apple | AUTH_APPLE_ID, AUTH_APPLE_SECRET, AUTH_APPLE_BUNDLE_IDENTIFIER |
AUTH_FACEBOOK_ID, AUTH_FACEBOOK_SECRET |
Google requires
NEXT_PUBLIC_AUTH_GOOGLE_ID in addition to the server-side credentials. This public variable is used to initialize the Google One Tap widget in the browser.Setting up Google
Create a Google OAuth app
Open the Google Cloud Console, create a new project (or select an existing one), and navigate to APIs & Services → Credentials. Create an OAuth 2.0 Client ID of type Web application.
Add your redirect URI
Add
https://your-store.com/api/auth/callback/google to the list of authorized redirect URIs.https://your-store.com/api/auth/callback/<provider>, and copy the client ID and secret into your .env.
Admin access
Admin users have theadmin role. Only admin users can access the /admin dashboard, manage products and orders, and upload files.
Default admin account
When you run86d init or docker compose up (which seeds automatically), a default admin account is created:
| Field | Value |
|---|---|
admin@example.com | |
| Password | password123 |
admin role directly in the database.
86d SSO
When86D_API_KEY is set, 86d.app SSO is enabled for admin authentication. This lets you sign in to your store’s admin using your 86d.app account credentials, with no separate admin password required.
.env
Email and password auth
Email and password login is enabled by default. Customers and admins can register and sign in using their email address and a password. Passwords are hashed using bcrypt and never stored in plaintext. To send password-reset and verification emails, setRESEND_API_KEY:
.env

