Category : keycloak

I am trying to get the username and uid of the logged-in user. In my application I used the ReactKeycloakProvider and useKeycloak() import {ReactKeycloakProvider} from ‘@react-keycloak/web’; import keycloak from ‘./keycloak’; const onKeycloakEvent = (event: any, error: any) => { console.log(‘onKeycloakEvent’, event, error) } const onKeycloakTokens = (tokens: any) => { console.log(‘onKeycloakTokens’, tokens) } const initOptions ..

Read more

I am trying to integrate Keycloak login into my React app and I’m trying to get the JWT from keycloak. Here is the code: const [keycloakState, setKeycloakState] = useState<any>(); const login = () => { const keycloak = Keycloak("/keycloak.json"); keycloak.init({onLoad: ‘login-required’}).then(authenticated => { console.log(‘kk’, keycloak) console.log(‘at’, authenticated) setKeycloakState({ keycloak: keycloak, authenticated: authenticated }); }).catch(err => ..

Read more

I am trying to add a sign out functionality using ambassador and Keycloak, however, every time I use ambassador to logout it logs out to an empty Keycloak page with the URL: http://auth-server/auth/realms/{realm-name}/protocol/openid-connect/logout currently, I use: https://www.getambassador.io/docs/latest/topics/using/filters/oauth2/#rp-initiated-logout however, according to Keycloak documentation, the URL expects a redirect_uri. Source: Ask Javascript..

Read more

I am not able to set client-secret in config object of keyClock function initializeKeycloak(keycloak: KeycloakService) { return () => keycloak.init({ config: { url: ‘http://localhost:8080/auth’, realm: ‘your-realm’, clientId: ‘your-client-id’, client-secret: ‘xxxxxxxxxxx’ <– problem }, initOptions: { onLoad: ‘check-sso’, silentCheckSsoRedirectUri: window.location.origin + ‘/assets/silent-check-sso.html’, }, }); } where we can set clicnt-secret? please help me with it Thank ..

Read more

So I’ve just created a new React project where I use the official keycloak-js adapter with the react-keycloak/web dependency for react bindings. I have followed all the "official" ways of doing things and I have this: keycloak.js (config): import Keycloak from "keycloak-js"; // Setup Keycloak instance as needed const keycloak = new Keycloak({ realm: "SomeRealm", ..

Read more

I have implement a really simple keycloak integration on my maven java web app. Assuming i call a url directly for the keycloak log in page . http://localhost:8180/auth/realms/myrealm/protocol/openid-connect/auth?client_id=myclientid&response_type=code&scope=openid&redirect_uri=http//localhost:8080/mypage.html After entering my username & password on success i am being redirected on mypage.html , the url is like this http://localhost:8080/mypage.html?session_state=c9482da3-50ff-4176-bf3c-54227271c661&code=5d4aebda-54d8-41ad-8205-c4d7e021770f.c9482da3-50ff-4176-bf3c-54227271c661.d5c1b6ac-c427-46da-8509-f2689849103b If i break this down its ..

Read more