Skip to content

Commit

Permalink
feat: 引入 @sidebase/nuxt-auth 模块
Browse files Browse the repository at this point in the history
  • Loading branch information
nonhana committed Nov 21, 2024
1 parent ea26367 commit ef16d06
Show file tree
Hide file tree
Showing 3 changed files with 429 additions and 6 deletions.
26 changes: 26 additions & 0 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,31 @@ export default defineNuxtConfig({
preload: true,
download: true,
},
auth: {
isEnabled: true,
disableServerSideAuth: false,
originEnvKey: 'HANA_AUTH_ORIGIN',
baseURL: 'http://localhost:2408/api/auth',
provider: {
type: 'local',
endpoints: {
signIn: { path: '/login', method: 'post' },
signOut: { path: '/logout', method: 'post' },
signUp: { path: '/register', method: 'post' },
getSession: { path: '/session', method: 'get' },
},
refresh: {
isEnabled: true,
endpoint: { path: '/refresh', method: 'post' },
refreshOnlyToken: true,
token: {
signInResponseRefreshTokenPointer: '/refresh-token',
refreshRequestTokenPointer: '/refresh-token',
maxAgeInSeconds: 60 * 60 * 24 * 7,
},
},
},
},
modules: [
'@nuxtjs/tailwindcss',
'@nuxtjs/i18n',
Expand All @@ -89,6 +114,7 @@ export default defineNuxtConfig({
'@nuxtjs/seo',
'@vueuse/nuxt',
'@pinia/nuxt',
'@sidebase/nuxt-auth',
],
plugins: ['~/plugins/directives.ts'],
devtools: { enabled: true },
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"@nuxtjs/tailwindcss": "^6.12.1",
"@pinia/nuxt": "^0.6.1",
"@prisma/client": "^5.22.0",
"@sidebase/nuxt-auth": "^0.9.4",
"@tailwindcss/forms": "^0.5.9",
"@tailwindcss/typography": "^0.5.15",
"@types/node": "^22.7.4",
Expand Down
Loading

0 comments on commit ef16d06

Please sign in to comment.