
Product
Socket Now Protects the Firefox Extension Ecosystem
Socket is bringing experimental protection to Firefox, scanning 97,000+ extensions in Mozilla's official directory for malware and risky updates.
@authon/nuxt
Advanced tools
English | 한국어
Drop-in Nuxt 3 authentication with plugin, composables, and route middleware — self-hosted Clerk alternative, Auth0 alternative
Before installing the SDK, create an Authon project and get your API keys:
Create a project at Authon Dashboard
Get your API keys from Project Settings → API Keys
pk_live_... or pk_test_...) — safe to use in client-side codesk_live_... or sk_test_...) — server-side only, never expose to clientsConfigure OAuth providers (optional) in Project Settings → OAuth
https://api.authon.dev/v1/auth/oauth/redirectTest vs Live keys: Use
pk_test_...during development. Switch topk_live_...before deploying to production. Test keys use a sandbox environment with no rate limits.
npm install @authon/nuxt
// plugins/authon.client.ts
import { createAuthonPlugin } from '@authon/nuxt';
export default defineNuxtPlugin(() => {
const config = useRuntimeConfig();
const authon = createAuthonPlugin(config.public.authonKey, {
apiUrl: config.public.authonApiUrl,
theme: 'auto',
});
return { provide: { authon } };
});
// nuxt.config.ts
export default defineNuxtConfig({
runtimeConfig: {
public: {
authonKey: process.env.NUXT_PUBLIC_AUTHON_KEY,
authonApiUrl: process.env.NUXT_PUBLIC_AUTHON_API_URL,
},
},
});
<!-- pages/index.vue -->
<script setup lang="ts">
const { $authon } = useNuxtApp();
const { client, isSignedIn, user } = $authon;
</script>
<template>
<div v-if="isSignedIn">
<p>Welcome, {{ user?.displayName }}</p>
<button @click="client.signOut()">Sign out</button>
</div>
<div v-else>
<button @click="client.openSignIn()">Sign in</button>
</div>
</template>
<script setup lang="ts">
const { $authon } = useNuxtApp();
async function signInWithGoogle() {
await $authon.client.signInWithOAuth('google');
}
</script>
<template>
<button @click="signInWithGoogle">Sign in with Google</button>
</template>
// middleware/auth.ts
import { createAuthMiddleware } from '@authon/nuxt';
export default defineNuxtRouteMiddleware((to, from) => {
const { $authon } = useNuxtApp();
return createAuthMiddleware($authon, '/sign-in')(to, from);
});
<!-- pages/dashboard.vue -->
<script setup>
definePageMeta({ middleware: 'auth' });
const { $authon } = useNuxtApp();
</script>
<template>
<h1>Welcome, {{ $authon.user?.displayName }}</h1>
</template>
<script setup lang="ts">
const { $authon } = useNuxtApp();
const { user, isLoading } = $authon;
</script>
<template>
<p v-if="isLoading">Loading...</p>
<p v-else-if="user">{{ user.email }}</p>
<p v-else>Not signed in</p>
</template>
<script setup lang="ts">
import { ref } from 'vue';
const { $authon } = useNuxtApp();
const email = ref('');
const password = ref('');
async function handleSignIn() {
await $authon.client.signInWithEmail(email.value, password.value);
}
</script>
<template>
<form @submit.prevent="handleSignIn">
<input v-model="email" type="email" placeholder="Email" />
<input v-model="password" type="password" placeholder="Password" />
<button type="submit">Sign In</button>
</form>
</template>
<script setup lang="ts">
const { $authon } = useNuxtApp();
</script>
<template>
<button @click="$authon.client.signOut()">Sign Out</button>
</template>
| Variable | Required | Description |
|---|---|---|
NUXT_PUBLIC_AUTHON_API_URL | Yes | Your Authon server URL |
NUXT_PUBLIC_AUTHON_KEY | Yes | Project publishable key |
| Function | Returns |
|---|---|
createAuthonPlugin(key, config?) | AuthonPluginState { client, user, isSignedIn, isLoading } |
createAuthMiddleware(authon, redirectTo?) | Route middleware function |
renderSocialButtons(options) | Cleanup function |
| Composable | Returns |
|---|---|
useAuthon() | AuthonPluginState (access via useNuxtApp().$authon in practice) |
useUser() | { user, isLoading } |
useAuthonWeb3() | Web3 wallet auth |
useAuthonPasswordless() | Magic link and OTP |
useAuthonPasskeys() | Passkey registration and auth |
| Feature | Authon | Clerk | Auth.js |
|---|---|---|---|
| Self-hosted | Yes | No | Partial |
| Pricing | Free | $25/mo+ | Free |
| OAuth providers | 10+ | 20+ | 80+ |
| Nuxt 3 module | Yes | No | Via Sidebase |
| MFA/Passkeys | Yes | Yes | Plugin |
| Web3 auth | Yes | No | No |
MIT
FAQs
Authon Nuxt 3 module — auto-imported composables and middleware
The npm package @authon/nuxt receives a total of 40 weekly downloads. As such, @authon/nuxt popularity was classified as not popular.
We found that @authon/nuxt demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket is bringing experimental protection to Firefox, scanning 97,000+ extensions in Mozilla's official directory for malware and risky updates.

Research
/Security News
Three compromised Rust crates pulled in a malicious dependency that downloaded and executed cross-platform malware during Cargo builds.

Research
/Security News
Socket uncovered 77 linked Firefox extensions, including 40 that steal wallet secrets or credentials and 37 deceptive sports-score shells.