@meistrari/auth-nuxt
@meistrari/auth-nuxt
A Nuxt module for authentication, organization management, and API key capabilities.
Auth Types
This SDK supports two interactive authentication models:
- Application Authentication (recommended): Use this for product applications that need end-user authentication and authorization scoped to a specific application. See Application Authentication Guide.
- First-Party Authentication: Use this only for trusted first-party tools that interact directly with the Auth API in an administrative way, such as the Accounts Dashboard and Backoffice. See First-Party Authentication Guide.
For machine-to-machine authentication, use @meistrari/auth-core directly on the server. See the Client Credentials Guide.
Installation
bun add @meistrari/auth-nuxt
Quick Start
export default defineNuxtConfig({
modules: ['@meistrari/auth-nuxt'],
telaAuth: {
apiUrl: 'https://auth.tela.com',
application: {
enabled: true,
dashboardUrl: 'https://accounts.tela.com',
applicationId: 'app_123',
redirectUri: 'https://your-app.com/auth/callback',
},
},
})
Application auth auto-imports useTelaApplicationAuth() and the application-mode useTelaOrganization(), registers <TelaRole>, installs role directives, and adds SDK routes under /auth/* plus /api/auth/api-key/** and /api/auth/organization/**. useTelaApiKey() is also available; in application mode it targets the local API key proxy for app-scoped user API keys.
First-party auth auto-imports useTelaSession(), useTelaSessionAssurance(), useTelaOrganization(), and useTelaApiKey().
Runtime configuration
Set deployment-specific values under runtimeConfig.telaAuth. These take precedence
over telaAuth module options, which provide defaults (including nested application settings).
export default defineNuxtConfig({
modules: ['@meistrari/auth-nuxt'],
telaAuth: {
application: { enabled: true },
},
runtimeConfig: {
telaAuth: {
apiUrl: '',
application: {
applicationId: '',
dashboardUrl: '',
redirectUri: '',
},
},
},
})
Override these values in the deployed server's environment without rebuilding:
NUXT_TELA_AUTH_API_URL=https://auth.example.com
NUXT_TELA_AUTH_JWT_COOKIE_NAME=my-jwt
NUXT_TELA_AUTH_APPLICATION_APPLICATION_ID=app_123
NUXT_TELA_AUTH_APPLICATION_DASHBOARD_URL=https://accounts.example.com
NUXT_TELA_AUTH_APPLICATION_REDIRECT_URI=https://app.example.com/auth/callback
NUXT_TELA_AUTH_APPLICATION_LOGIN_PATH=/login
NUXT_TELA_AUTH_APPLICATION_UNAUTHORIZED_PATH=/unauthorized
The module declares these runtime keys even when omitted from your config. Server
handlers read runtimeConfig.telaAuth; the SDK copies its supported settings to
runtimeConfig.public.telaAuth per request for browser composables and plugins.
These settings are public: do not use them for credentials or secrets.
application.enabled and skipServerMiddleware select registrations at build time;
set them in telaAuth or runtimeConfig.telaAuth before building. Changing those
flags in the deployed environment cannot change which routes or plugins were built.
Static prerendered output retains the values from prerendering.
API Reference
See it on Pantry
Related Packages
Embed do editor de minuta (docx paginado A4) do defesa.ai para apps Nuxt — compo...
Nuxt module that adds a complete AI chat interface to your app. Server-side chat...
Version History
| Version | Released | License |
|---|---|---|
| 5.8.0 | ||
| 5.7.0 | ||
| 5.6.0 | ||
| 5.5.0 | ||
| 5.4.0 | ||
| 5.3.1 | ||
| 5.3.0 | ||
| 5.2.0 | ||
| 5.1.0 | ||
| 5.0.0 | ||
| 4.3.0 | ||
| 4.2.0 | ||
| 4.1.0 | ||
| 3.31.2 | ||
| 3.31.1 | ||
| 3.31.0 | ||
| 3.30.0 | ||
| 3.29.3 | ||
| 3.29.2 | ||
| 3.29.1 | ||
| 3.29.0 | ||
| 3.28.0 | ||
| 3.27.0 | ||
| 3.26.0 | ||
| 3.25.0 | ||
| 3.24.0 | ||
| 3.23.1 | ||
| 3.23.0 | ||
| 3.22.0 | ||
| 3.21.0 |
Showing the latest 30 of 98. See every release on npm
Pre-releases (1)
| Version | Released | License |
|---|---|---|
| 1.0.0-beta.1 |