keycloak teil 2
This commit is contained in:
@@ -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 '@fontsource-variable/inter/wght.css';
|
||||||
import './index.css'
|
import './index.css'
|
||||||
import App from './App.tsx'
|
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 React from 'react';
|
||||||
|
import keycloak from '../keycloak';
|
||||||
|
|
||||||
const HomePage: React.FC = () => {
|
const HomePage: React.FC = () => {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<h1>Welcome to the Home Page</h1>
|
<h1>Welcome to the Home Page</h1>
|
||||||
<p>This is the main landing page of the application.</p>
|
<p>This is the main landing page of the application.</p>
|
||||||
|
<p>Angemeldet als: {keycloak.tokenParsed?.preferred_username}</p>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user