I have api endpoint user/profile return json data
{ "data": { "first_name": "Rafael", "last_name": "Rafael", "email": "rafael@mail.com", "phone": "+7111111111" }, "message": "Completed successfully", "status": true }
when authorizing all this data is saved in the session I only need the data field
nuxt.config.ts
export default defineNuxtConfig({
runtimeConfig: {
authSecret: '12345678',
},
devtools: { enabled: true },
modules: ['@pinia/nuxt', '@sidebase/nuxt-auth'],
auth: {
baseURL: 'http://localhost:8001/api/v1/en/',
provider: {
type: 'local',
token: {
signInResponseTokenPointer: '/data/token',
type: '',
cookieName: 'auth.token',
headerName: 'Authorization',
maxAgeInSeconds: 1800,
sameSiteAttribute: 'lax',
cookieDomain: 'localhost',
secureCookieAttribute: false,
httpOnlyCookieAttribute: false,
},
endpoints: {
signIn: { path: 'login', method: 'post' },
signOut: { path: 'logout', method: 'post' },
signUp: { path: 'register', method: 'post' },
getSession: { path: 'user/profile', method: 'get' },
},
},
sessionRefresh: {
enablePeriodically: false,
enableOnWindowFocus: false,
},
},
What need write here server/api/auth/[...].ts if i use provider type local?
nuxt.config.ts need add this
session: { dataResponsePointer: '/data' },
export default defineNuxtConfig({
modules: ['@pinia/nuxt', '@sidebase/nuxt-auth'],
auth: {
baseURL: 'http://localhost:8001/api/v1/en/',
provider: {
type: 'local',
token: {
signInResponseTokenPointer: '/data/token',
type: '',
cookieName: 'auth.token',
headerName: 'Authorization',
maxAgeInSeconds: 1800,
sameSiteAttribute: 'lax',
cookieDomain: 'localhost',
secureCookieAttribute: false,
httpOnlyCookieAttribute: false,
},
session: { dataResponsePointer: '/data' },
endpoints: {
signIn: { path: 'login', method: 'post' },
signOut: { path: 'logout', method: 'post' },
signUp: { path: 'register', method: 'post' },
getSession: { path: 'user/profile', method: 'get' },
},
},
sessionRefresh: {
enablePeriodically: false,
enableOnWindowFocus: false,
},
},