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?