App login
End users sign in on auth.v8r.app. Each app is its own OAuth client. The client id is the namespace padded to 32 characters, and the client secret is any live project token. The same V8R_TOKEN also vends CDN credentials.
Users can continue with Google or GitHub, or sign in with email. Provider credentials are managed by v8r; apps use the same sign-in endpoint and receive the same user profile with every method.
1. Install
pnpm add @v8r/auth
2. Read the user
import { createV8rAuth } from "@v8r/auth/next";
export const v8r = createV8rAuth({
namespace: process.env.V8R_NAMESPACE!,
token: process.env.V8R_TOKEN!,
});
const user = await v8r.getUser();
// { id, email, emailVerified, name, image } or null3. Mount the callback
// app/api/v8r/[...v8r]/route.ts
export const { GET, POST } = v8r.handlers;Send people to /api/v8r/sign-in. The callback is https://<namespace>.v8r.app/api/v8r/callback. Add localhost callbacks from the project console when you need them. v8r.signOut() clears the app cookie and the login session.
Storage
const creds = await v8r.getCdnCredentials({ ttlSeconds: 900 });That posts V8R_TOKEN to https://www.v8r.dev/api/cdn/credentials. The token stays on the server.