@openape/nuxt-auth-sp
| Install | |
|---|---|
npm install @openape/nuxt-auth-sp |
|
| Latest Version: | 0.15.2 |
| Vue: | 3 |
| License: | MIT |
| Last Updated: | Oct 23, 2026 |
| Links: | GitHub · npm |
@openape/nuxt-auth-sp
Nuxt module that adds DDISA-based login to your application. Users enter their email, the module discovers their Identity Provider via DNS, and handles the full authorization flow — no pre-configured IdP list needed.
Installation
npm install @openape/nuxt-auth-sp
// nuxt.config.ts
export default defineNuxtConfig({
modules: ['@openape/nuxt-auth-sp'],
openapeSp: {
clientId: 'sp.example.com',
spName: 'My Service',
sessionSecret: 'your-secret-min-32-chars...',
},
})
Configuration
| Option | Type | Default | Description |
|---|---|---|---|
clientId |
string |
— | Required. Service Provider identifier (typically your domain) |
spName |
string |
'OpenApe Service Provider' |
Display name shown during authorization |
sessionSecret |
string |
'change-me-sp-secret-...' |
Session encryption key |
openapeUrl |
string |
— | Override IdP URL (bypasses DNS discovery) |
Routes
| Method | Path | Description |
|---|---|---|
POST |
/api/login |
Start login — { email } → { redirectUrl } |
GET |
/api/callback |
Handle callback from IdP |
POST |
/api/logout |
End session |
GET |
/api/me |
Get current user (DDISAAssertionClaims) |
GET |
/.well-known/sp-manifest.json |
SP manifest for IdP discovery |
Composables
useOpenApeAuth()
const { user, loading, fetchUser, login, logout } = useOpenApeAuth()
// user: Ref<DDISAAssertionClaims | null>
// DDISAAssertionClaims: { sub, iss, aud, act, iat, exp, nonce, ... }
await login('user@example.com') // Redirects to user's IdP
await logout() // Clears session, navigates to /
Middleware
The module provides an openape-auth middleware that protects pages from unauthenticated access.
// pages/dashboard.vue
definePageMeta({
middleware: 'openape-auth',
})
Unauthenticated users are redirected to the login page.
DNS Discovery
When a user logs in with user@example.com, the module:
- Extracts the domain (
example.com) - Looks up the
_ddisa.example.comTXT record - Parses the DDISA record to find the IdP URL
- Redirects the user to the IdP's authorization endpoint with PKCE
- Handles the callback and validates the signed assertion
This means any domain with a DDISA DNS record can authenticate — no pre-registration needed.
For details on DNS resolution, see @openape/core.
Quick Start
// nuxt.config.ts
export default defineNuxtConfig({
modules: ['@openape/nuxt-auth-sp'],
openapeSp: {
clientId: 'localhost:3001',
spName: 'My App',
sessionSecret: 'at-least-32-characters-long-secret-here',
},
})
<!-- pages/index.vue -->
<script setup>
const { user, login, logout } = useOpenApeAuth()
const email = ref('')
</script>
<template>
<div v-if="user">
Logged in as {{ user.sub }}
<button @click="logout">Logout</button>
</div>
<form v-else @submit.prevent="login(email)">
<input v-model="email" type="email" placeholder="you@example.com" />
<button type="submit">Login</button>
</form>
</template>
See the examples directory for a fully working SP setup.
License
Related Packages
OpenApe Identity Provider Nuxt module — adds user auth, OAuth, admin, and agent...
Version History
| Version | Released | Vue | License |
|---|---|---|---|
| 0.15.2 | ^3.0 | MIT | |
| 0.15.1 | ^3.0 | MIT | |
| 0.15.0 | ^3.0 | MIT | |
| 0.14.0 | ^3.0 | MIT | |
| 0.12.1 | ^3.0 | MIT | |
| 0.12.0 | ^3.0 | MIT | |
| 0.11.3 | ^3.0 | MIT | |
| 0.11.2 | ^3.0 | MIT | |
| 0.11.1 | ^3.0 | MIT | |
| 0.11.0 | ^3.0 | MIT | |
| 0.10.2 | ^3.0 | MIT | |
| 0.10.1 | ^3.0 | MIT | |
| 0.10.0 | ^3.0 | MIT | |
| 0.9.3 | ^3.0 | MIT | |
| 0.9.2 | ^3.0 | MIT | |
| 0.9.1 | ^3.0 | MIT | |
| 0.9.0 | ^3.0 | MIT | |
| 0.8.9 | ^3.0 | MIT | |
| 0.8.8 | ^3.0 | MIT | |
| 0.8.7 | ^3.0 | MIT | |
| 0.8.6 | ^3.0 | MIT | |
| 0.8.5 | ^3.0 | MIT | |
| 0.8.4 | ^3.0 | MIT | |
| 0.8.3 | ^3.0 | MIT | |
| 0.8.2 | ^3.0 | MIT | |
| 0.8.1 | ^3.0 | MIT | |
| 0.8.0 | ^3.0 | MIT | |
| 0.7.0 | ^3.0 | MIT | |
| 0.6.10 | ^3.0 | MIT | |
| 0.6.9 | ^3.0 | MIT |
Showing the latest 30 of 54. See every release on npm