@geanlima/simpleauth
v1.2.0
Published
A simple authentication module using token
Downloads
5
Readme
Simple Auth
A simple authentication module using token
Designed to be used with tymondesigns/jwt-auth
Features
Quick Setup
Install the module to your Nuxt application with one command:
npx nuxi module add @geanlima/simpleauth
That's it! You can now use Simple Auth in your Nuxt app ✨
Use
export default defineNuxtConfig({
modules: ['@geanlima/simpleauth'],
simpleAuth: {
loginPage: '/', // Authentication page
homePage: '/home', // Authenticated User Page
baseUrl: 'http://localhost:8000/api', // API base URL, if not passed it will only use the URL field
login: {
url: '/login',
method: 'POST',
token: {
field: 'access_token',
field_expires: 'expires_in', // Time in seconds that the token is valid
},
},
logout: {
url: '/auth/me',
method: 'POST',
},
refresh: {
url: '/auth/refresh',
method: 'POST',
token: {
field: 'access_token',
field_expires: 'expires_in',
},
},
me: {
url: '/auth/me',
method: 'POST',
},
}
})
Contribution
# Install dependencies
npm install
# Generate type stubs
npm run dev:prepare
# Develop with the playground
npm run dev
# Build the playground
npm run dev:build
# Run ESLint
npm run lint
# Run Vitest
npm run test
npm run test:watch
# Release new version
npm run release