implemented authentication with sidebase/nuxt-auth
This commit is contained in:
@ -1,15 +1,52 @@
|
||||
// https://nuxt.com/docs/api/configuration/nuxt-config
|
||||
import type {
|
||||
NuxtPage
|
||||
} from 'nuxt/schema'
|
||||
import type { NuxtPage } from 'nuxt/schema'
|
||||
import clientsideConfig from './clientsideConfig'
|
||||
import { UserObjectDefinition } from './composables/UserObject'
|
||||
|
||||
export default defineNuxtConfig({
|
||||
devtools: { enabled: true },
|
||||
modules: [
|
||||
'@pinia/nuxt',
|
||||
],/*
|
||||
buildModules: [
|
||||
'@nuxtjs/composition-api/module',
|
||||
'@sidebase/nuxt-auth',
|
||||
],
|
||||
auth: {
|
||||
//baseURL: `https://${clientsideConfig.url}:${clientsideConfig.port}/.output/server/chunks/routes/api/auth`,
|
||||
computed: {
|
||||
origin: `https://${clientsideConfig.url}:${clientsideConfig.port}/`,
|
||||
//pathname: '/server/chunks/routes/api/auth/',
|
||||
//fullBaseUrl: `https://${clientsideConfig.url}:${clientsideConfig.port}/server/chunks/routes/api/auth/`,
|
||||
},
|
||||
//baseUrl: `https://${clientsideConfig.url}:${clientsideConfig.port}/server/chunks/routes/api/auth/`,
|
||||
provider: {
|
||||
type: 'refresh',
|
||||
endpoints: {
|
||||
signIn: { path: '/login', method: 'post' },
|
||||
signout: false,
|
||||
signUp: { path: '/signup', method: 'post' },
|
||||
getSession: { path: '/session', method: 'get' },
|
||||
refresh: { path: '/refresh', method: 'post' }
|
||||
},
|
||||
token: {
|
||||
signInResponseTokenPointer: '/token/authToken',
|
||||
maxAgeInSeconds: 300, // 5 min
|
||||
sameSiteAttribute: 'lax'
|
||||
},
|
||||
refreshToken: {
|
||||
signInResponseRefreshTokenPointer: '/token/refreshToken',
|
||||
maxAgeInSeconds: 604800, // 7 days
|
||||
sameSiteAttribute: 'lax'
|
||||
},
|
||||
// TODO: define UserObject
|
||||
//sessionDataType: UserObjectDefinition,
|
||||
},
|
||||
session: {
|
||||
enableRefreshPeriodically: false,
|
||||
enableRefreshOnWindowFocus: true,
|
||||
},
|
||||
globalAppMiddleware: true,
|
||||
},
|
||||
/*buildModules: [
|
||||
//'@nuxtjs/composition-api/module',
|
||||
['@pinia/nuxt', { disableVuex: false }],
|
||||
],*/
|
||||
devServer: {
|
||||
@ -26,6 +63,19 @@ export default defineNuxtConfig({
|
||||
},
|
||||
}
|
||||
},
|
||||
runtimeConfig: {
|
||||
public: {
|
||||
apiBase: `https://${clientsideConfig.url}:${clientsideConfig.port}/server/chunks/routes/api`,
|
||||
axios: {
|
||||
browserBaseURL: `https://${clientsideConfig.url}:${clientsideConfig.port}/`,
|
||||
},
|
||||
},
|
||||
private: {
|
||||
axios: {
|
||||
baseURL: `https://${clientsideConfig.url}:${clientsideConfig.port}/`,
|
||||
}
|
||||
}
|
||||
},
|
||||
// hooks: {
|
||||
// 'pages:extend'(pages) {
|
||||
// function setMiddleware(pages: NuxtPage[]) {
|
||||
|
||||
Reference in New Issue
Block a user