Framework Integrations
Nuxt
Mount Radon in Nuxt 3 / Nitro — an h3 event handler at a catch-all route plus getUser. A Radon Pro feature.
Radon Pro
The Nuxt integration is a Pro feature and requires a license. See Radon Pro.
Radon plugs into Nuxt 3's Nitro server (h3) as an event handler you place at a catch-all server route.
1. Mount the auth routes
import { radonNuxt } from "@radonsdk/auth/pro/integrations/nuxt";
import { auth } from "~/server/utils/auth";
export default radonNuxt(auth, { basePath: "/api/auth" });Where to put the auth instance
Keep your configured auth in server/utils/auth.ts so Nitro auto-imports it.
Call await auth.init() on startup (e.g. a Nitro plugin) to verify the license.
2. Read the user in a server route
getUser(auth, event) takes the h3 event and returns the user or null.
import { getUser } from "@radonsdk/auth/pro/integrations/nuxt";
import { auth } from "~/server/utils/auth";
export default defineEventHandler(async (event) => {
const user = await getUser(auth, event);
if (!user) throw createError({ statusCode: 401 });
return user;
});3. Gate with middleware
import { getUser } from "@radonsdk/auth/pro/integrations/nuxt";
import { auth } from "~/server/utils/auth";
export default defineEventHandler(async (event) => {
event.context.user = await getUser(auth, event);
});