Examples

Vite SPA (PKCE)

A public OAuth client using Authorization Code + PKCE — no secret, for browser, mobile, and CLI apps.

Vite SPA (PKCE) sign-in screen

A pure browser app using the Authorization Code + PKCE flow — the right pattern for SPAs, mobile, and CLIs where you can't safely keep a secret. It signs the user in, then calls the API with their access token.

Because there's no secret, the only sensitive step is proving possession of the PKCE verifier at the token endpoint — so this pattern is safe to ship entirely in the browser bundle.

Deploy it

Or scaffold it locally:npm create @model-match -- --template vite-spa-pkce

What you'll need

A public OAuth client registered with Model Match, and its redirect URI set to your deployed callback (https://your-app/oauth/callback). See Authentication.

Environment variables

VariableRequiredNotes
VITE_MODEL_MATCH_CLIENT_IDyesYour public OAuth client ID (no secret).
VITE_MODEL_MATCH_ISSUERnoDefaults to https://auth.modelmatch.com/api/auth.
VITE_MMR_API_URLnoDefaults to https://api.modelmatch.com.
VITE_MODEL_MATCH_REDIRECT_URIyesMust match a redirect URI on your OAuth client.

Run it locally

npm create @model-match -- --template vite-spa-pkce
cd vite-spa-pkce
npm install
npm run dev

Open localhost:5173 and sign in.

On this page