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