real keycloak instance
This commit is contained in:
parent
49ec6d3897
commit
e82e62da23
@ -18,6 +18,11 @@ 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');
|
||||
|
@ -1,18 +0,0 @@
|
||||
const loginTest = () => {
|
||||
let data = {
|
||||
client_id: 'Id_of_your_client',
|
||||
username: 'test',
|
||||
password: 'test',
|
||||
grant_type: 'password'
|
||||
};
|
||||
|
||||
fetch('http://0.0.0.0:8080/auth/realms/test/protocol/openid-connect/token', {
|
||||
method: 'POST',
|
||||
headers: {'Content-Type': 'application/json'},
|
||||
body: JSON.stringify(data)
|
||||
}).then(res => {
|
||||
console.log('Request complete! response:', res);
|
||||
});
|
||||
};
|
||||
|
||||
export default loginTest;
|
@ -1,9 +1,9 @@
|
||||
import Keycloak from 'keycloak-js';
|
||||
|
||||
const _kc = new Keycloak({
|
||||
url: 'http://0.0.0.0:8080/',
|
||||
realm: 'test',
|
||||
clientId: 'test'
|
||||
url: 'https://auth-dev.csi.wmi.amu.edu.pl/',
|
||||
realm: 'gonito-dev',
|
||||
clientId: 'gonito-dev-heroku'
|
||||
});
|
||||
|
||||
const initKeycloak = (onAuthenticatedCallback) => {
|
||||
@ -13,8 +13,10 @@ const initKeycloak = (onAuthenticatedCallback) => {
|
||||
pkceMethod: 'S256',
|
||||
})
|
||||
.then((authenticated) => {
|
||||
console.log('user is authenticated!');
|
||||
console.log(isLoggedIn());
|
||||
if (!authenticated) {
|
||||
console.log('user is not authenticated..!');
|
||||
console.log('user is NOT authenticated..!');
|
||||
}
|
||||
onAuthenticatedCallback();
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user