Overview
Canvas apps support built-in authentication powered by Clerk. When you enable auth, your users can sign up and sign in via Google, GitHub, or email/password — with no extra libraries or configuration on your part. The auth SDK is auto-injected into your app at runtime. You get awindow.MixpeekAuth object with methods to check sign-in state, show modals, and access user profiles.
Enabling Auth
Enable Clerk authentication by updating your app’sauth_config:
"clerk" automatically:
- Injects
window.__MIXPEEK__with Clerk configuration - Loads the
/_auth/sdk.jsscript into your app - Enforces authentication on all
/_apiproxy requests
You do not need to install or import any auth libraries. The canvas runtime handles everything.
Using MixpeekAuth in Your App
The SDK exposeswindow.MixpeekAuth with the following API:
| Property / Method | Type | Description |
|---|---|---|
MixpeekAuth.onReady(callback) | (fn) => void | Called when auth is initialized |
MixpeekAuth.isSignedIn | boolean | Whether the current user is signed in |
MixpeekAuth.user | object | { id, email, name, avatar_url } |
MixpeekAuth.showSignIn() | () => void | Opens the Clerk sign-in modal |
MixpeekAuth.showSignUp() | () => void | Opens the Clerk sign-up modal |
MixpeekAuth.signOut() | () => void | Signs out and reloads the page |
React Example
Auth Endpoints
The canvas runtime exposes three auth endpoints on your app’s domain:| Endpoint | Method | Description |
|---|---|---|
/_auth/me | GET | Returns the current user’s profile |
/_auth/users | GET | Lists all users for this app (requires auth) |
/_auth/sdk.js | GET | The auth SDK script (auto-loaded, but you can load it manually) |
API Access and Billing
All/_api requests are authenticated with the app owner’s API key — your end-users never need their own Mixpeek credentials.
- Usage is billed to the organization that owns the Canvas app
- The
/_apiproxy supports all Mixpeek API methods: retrievers, collections, documents, and marketplace - End-users interact with your app; your API key handles the backend calls transparently
User Storage
When users sign up through your app, their metadata (email, name, avatar) is stored automatically. Each app maintains its own user list, scoped independently from other apps. Access user data via the/_auth/users endpoint:
Auth Providers
By default, Clerk authentication supports:- Google — OAuth sign-in
- GitHub — OAuth sign-in
- Email / password — standard credentials
auth_config.clerk_allowed_providers:
Omit
clerk_allowed_providers to enable all default providers (Google, GitHub, and email/password).
