I created a NUXT site with the NUXT AUTH and it works fine, except when I enter the first page on the web app. The web app tries to call the user endpoint but since I haven't logged in yet this endpoint naturally returns
Failed to load resource: the server responded with a status of 401 (Unauthorized)
My nuxt auth configuration in nuxt.config.js looks like this
auth: {
strategies: {
local: {
endpoints: {
login: {
url: '/token',
method: 'post',
propertyName: 'access_token'
},
logout: { url: '/api/account/logout', method: 'post' },
user: {
url: '/api/account/getCurrentUser',
method: 'get',
propertyName: false
}
},
tokenType: 'bearer',
autoFetchUser: true
}
},
redirect: {
home: '/',
callback: false,
logout: '/',
login: '/login'
}
}
Can anybody help me get rid of the 401 error? I just want the user endpoint to be called after login