Closed ssoerensen closed 1 month ago
keycloak-config
alisa with the following expression import keycloakConfig from 'keycloak-config';
npm run build
then started with the serve -s build
or live-server build --host=localhost --port=3000
, then the configuration is taken from the 'keycloak-config.production.json'.npm start
, then the configuration is taken from the 'keycloak-config.json'.config-overrides.js
module.exports = override(
...
// Add Webpack alias for Keycloak configuration based on the environment
(config) => {
const isProduction = process.env.NODE_ENV === 'production';
// Define the path to the correct keycloak-config based on the environment
config.resolve.alias['keycloak-config'] = path.resolve(
__dirname,
isProduction
? 'src/keycloak-config.prod.json' // Production environment
: 'src/keycloak-config.json' // Development environment
);
// Return the modified Webpack config
return config;
}
);
src/keycloak-config.json
{
"config": {
"realm": "gaia-x",
"clientId": "portal",
},
"initOptions": {
"onLoad": "check-sso",
"checkLoginIframe": false,
"pkceMethod": "S256"
}
}
url
is taken from the .env
.
...
REACT_APP_KEYCLOAK_API_URL=https://fc-keycloak.gxfs.gx4fm.org/
...
src/context/AuthContextProvider.tsx
https://my.msg-david.de/confluence/display/GAIAX/PoC%3A+Authentication+via+Keycloak