keycloak corrections: set checkLoginIframe to false
This commit is contained in:
parent
07ed3c86ef
commit
353983c99f
@ -18,11 +18,6 @@ import LoggedBar from './components/elements/LoggedBar';
|
||||
const App = () => {
|
||||
const [loggedBarVisible, setLoggedBarVisible] = React.useState('100vw');
|
||||
|
||||
React.useEffect(() => {
|
||||
console.log('czy zalogowany');
|
||||
console.log(KeyCloakService.isLoggedIn());
|
||||
});
|
||||
|
||||
const loggedBarVisibleHandler = () => {
|
||||
if (loggedBarVisible === '0')
|
||||
setLoggedBarVisible('100vw');
|
||||
|
@ -3,8 +3,8 @@ import ReactDOM from 'react-dom/client';
|
||||
import './index.css';
|
||||
import './normalize.css';
|
||||
import App from './App';
|
||||
// import KeyCloakService from './services/KeyCloakService';
|
||||
// import HttpService from './services/HttpService';
|
||||
import KeyCloakService from './services/KeyCloakService';
|
||||
import HttpService from './services/HttpService';
|
||||
|
||||
const root = ReactDOM.createRoot(document.getElementById('root'));
|
||||
|
||||
@ -14,7 +14,7 @@ const renderApp = () => root.render(
|
||||
</React.StrictMode>
|
||||
);
|
||||
|
||||
// KeyCloakService.initKeycloak(renderApp);
|
||||
// HttpService.configure();
|
||||
KeyCloakService.initKeycloak(renderApp);
|
||||
HttpService.configure();
|
||||
|
||||
renderApp();
|
@ -1,20 +1,31 @@
|
||||
import Keycloak from 'keycloak-js';
|
||||
|
||||
// const _kc = new Keycloak({
|
||||
// url: 'https://auth-dev.csi.wmi.amu.edu.pl/',
|
||||
// realm: 'gonito-dev',
|
||||
// clientId: 'gonito-dev-localhost'
|
||||
// });
|
||||
|
||||
const _kc = new Keycloak({
|
||||
url: 'https://auth-dev.csi.wmi.amu.edu.pl/',
|
||||
realm: 'gonito-dev',
|
||||
clientId: 'gonito-dev-heroku'
|
||||
});
|
||||
|
||||
// const _kc = new Keycloak({
|
||||
// url: 'http://0.0.0.0:8080',
|
||||
// realm: 'test',
|
||||
// clientId: 'test'
|
||||
// });
|
||||
|
||||
const initKeycloak = (onAuthenticatedCallback) => {
|
||||
_kc.init({
|
||||
onLoad: 'check-sso',
|
||||
silentCheckSsoRedirectUri: window.location.origin + '/silent-check-sso.html',
|
||||
pkceMethod: 'S256',
|
||||
checkLoginIframe: false
|
||||
})
|
||||
.then((authenticated) => {
|
||||
console.log('user is authenticated!');
|
||||
console.log(isLoggedIn());
|
||||
if (!authenticated) {
|
||||
console.log('user is NOT authenticated..!');
|
||||
}
|
||||
@ -31,9 +42,7 @@ const getToken = () => _kc.token;
|
||||
|
||||
const doRegister = _kc.register;
|
||||
|
||||
const isLoggedIn = () => {
|
||||
return _kc.authenticated;
|
||||
};
|
||||
const isLoggedIn = () => !!_kc.token;
|
||||
|
||||
const updateToken = (successCallback) =>
|
||||
_kc.updateToken(5)
|
||||
|
Loading…
Reference in New Issue
Block a user