keycloak teil 2

This commit is contained in:
2026-08-03 22:42:59 +02:00
parent 0a8fd60c96
commit fd1d0bdda5
3 changed files with 19 additions and 6 deletions
@@ -0,0 +1,7 @@
import Keycloak from 'keycloak-js';
const keycloak = new Keycloak({
url: 'https://barefacedlean.ddnss.de:9099',
realm: 'simplycpq',
clientId: 'simplycpq',
});
export default keycloak;
@@ -4,9 +4,13 @@ import { createRoot } from 'react-dom/client'
import '@fontsource-variable/inter/wght.css';
import './index.css'
import App from './App.tsx'
import keycloak from './keycloak.ts';
keycloak.init({ onLoad: 'login-required' }).then(() => {
createRoot(document.getElementById('root')!).render(
<StrictMode>
<App />
</StrictMode>,
)
});
createRoot(document.getElementById('root')!).render(
<StrictMode>
<App />
</StrictMode>,
)
@@ -1,10 +1,12 @@
import React from 'react';
import keycloak from '../keycloak';
const HomePage: React.FC = () => {
return (
<div>
<h1>Welcome to the Home Page</h1>
<p>This is the main landing page of the application.</p>
<p>Angemeldet als: {keycloak.tokenParsed?.preferred_username}</p>
</div>
);
};