openrtc-template-auth
v0.1.0
Published
Thin AuthAdapter interface + provider adapters (Better Auth, Clerk, Supabase, Firebase, Auth0) for OpenRTC starter templates.
Readme
openrtc-template-auth
Thin auth abstraction used by the OpenRTC starter templates. It wraps the
~2 calls the templates make (getSession, optional listOrgs) — nothing
more. Adapters take the provider instance you construct in your app
(dependency injection), so this package has zero provider dependencies.
Adapters
| Provider | Factory | Inject |
| --- | --- | --- |
| Better Auth (default) | betterAuthAdapter({ auth }) | your betterAuth({...}) instance |
| Clerk | clerkAdapter({ clerk }) | createClerkClient(...) from @clerk/backend |
| Supabase | supabaseAdapter({ createClient }) | request-scoped createServerClient factory (@supabase/ssr) |
| Firebase | firebaseAdapter({ adminAuth }) | getAuth(app) from firebase-admin/auth |
| Auth0 | auth0Adapter({ auth0 }) | Auth0Client from @auth0/nextjs-auth0 |
Bring your own
AuthAdapter is a plain object type — a custom provider is:
import type { AuthAdapter } from 'openrtc-template-auth';
export const myAuth: AuthAdapter = {
id: 'custom',
signInPath: '/login',
signOutPath: '/logout',
async getSession(request) {
const user = await verifyMyCookie(request);
return user ? { user: { id: user.id, email: user.email } } : null;
},
};The user.id returned here is the identity the templates hand to OpenRTC
token minting — keep it stable per user.
