Hm, this might be an issue on the SirixDB HTTP-Server side you’re running into with the expired token. Or hmmm… I’m not sure if the SirixDB HTTP-Server or the Node.js server from Nuxt.js should issue a new token. I guess probably the Node.js server, as it received the token in the first place and needs to also store the new token.
Regarding my problem with CORS, my nuxt config so far. However, it proxies the calls to the SirixDB HTTP-Server correctly somehow, as the login via Keycloak works with Chrome (not so with Firefox somehow).
import { Agent } from 'https';
export default {
mode: 'universal',
/*
** Headers of the page
*/
server: {
port: 3005, // default: 3000
host: "0.0.0.0" // default: localhost
},
head: {
title: process.env.npm_package_name || '',
meta: [
{
charset: 'utf-8'
},
{
name: 'viewport',
content: 'width=device-width, initial-scale=1'
},
{
hid: 'description',
name: 'description',
content: process.env.npm_package_description || ''
}
],
link: [
{
rel: 'icon',
type: 'image/x-icon',
href: '/favicon.ico'
}
]
},
/*
** Customize the progress-bar color
*/
loading: {
color: '#fff'
},
/*
** Global CSS
*/
css: ['element-ui/lib/theme-chalk/index.css'],
/*
** Plugins to load before mounting the App
*/
plugins: ['@/plugins/element-ui', '@/plugins/dependencyContainer.ts', '@/plugins/axios'],
/*
** Nuxt.js dev-modules
*/
buildModules: ['@nuxt/typescript-build'],
/*
** Nuxt.js modules
*/
modules: ['@nuxtjs/pwa', ['@nuxtjs/axios', { baseURL: 'https://localhost:9443', rejectUnauthorized: false }], '@nuxtjs/auth', '@nuxtjs/proxy', '@nuxtjs/toast'],
/*
** Build configuration
*/
build: {
transpile: [/^element-ui/],
vendor: ['axios'],
/*
** You can extend webpack config here
*/
extend: function (config, {isDev, isClient}) {
config.node = {
fs: "empty"
};
}
},
axios: {
baseURL: 'https://localhost:9443',
browserBaseURL: 'https://localhost:9443',
proxyHeaders: true,
proxy: true,
debug: true,
},
auth: {
strategies: {
keycloak: {
_scheme: 'oauth2',
authorization_endpoint: '/user/authorize',
userinfo_endpoint: false,
access_type: 'offline',
access_token_endpoint: '/token',
response_type: 'code',
token_type: 'Bearer',
token_key: 'access_token',
grant_type: 'authorization_code'
},
},
redirect: {
login: '/login',
callback: '/callback',
home: '/'
},
},
router: {
middleware: ['auth']
},
proxy: {
'/user/authorize': {
target: 'https://192.168.178.44:9443',
agent: new Agent({ rejectUnauthorized: false }),
changeOrigin: true
},
'/token': {
target: 'http://192.168.178.44:9443',
agent: new Agent({ rejectUnauthorized: false }),
changeOrigin: true
},
'/sirix': {
target: 'https://192.168.178.44:9443/',
pathRewrite: {'^/sirix/': ''},
agent: new Agent({ rejectUnauthorized: false }),
changeOrigin: true
}
}
}