1

I'm using npm packet keycloak-js in vue 3 app. Keycloak server and keycloak-js with same versions 24.0.2

import Keycloak from 'keycloak-js' let initOptions = { url: 'https://address' realm: 'myrealm', clientId: 'myapp' } let keycloak = new Keycloak(initOptions); try { const authenticated = await keycloak.init({ onLoad: 'login-required', checkLoginIframe: false }); console.log(`User is ${authenticated ? 'authenticated' : 'not authenticated'}`); } catch (error) { console.error('Failed to initialize adapter:', error); } 

Error in console is "Failed to initialize adapter: undefined"

In browser I found this

"Cookies with the SameSite=None; Secure and not Partitioned attributes that operate in cross-site contexts are third-party cookies. In future Chrome versions, reading third-party cookies will be blocked. This behavior protects user data from cross-site tracking."

Affected resources is keycloak cookies and token, so probably this is reason.

Token status 401, but on Keycloack server I can see that session appeared.

By searching solution I found that checkLoginIframe: false can help, but it isn't.

Can anyone advise on this issue please, why keycloak.init() doesn't work and how I can fix it?

1
  • Issue resolved. it was issue with enabled confidential mode on Keycloak server, Changes confidential to Public in clientID - this is resolved issue Commented Mar 27, 2024 at 13:15

1 Answer 1

1

Issue resolved. it was issue with enabled confidential mode on Keycloak server, Changes confidential to Public in clientID - this is resolved issue

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.