We are using Keycloak 15 for our application, and we are using keycloak-js (Version 15 also : https://www.npmjs.com/package/keycloak-js)
Our application would have two ways of authenticating for 2 users.
One way is the standard way with the redirection on our keycloak instance login page.
The other way tho, require us to manually call keycloak back-end for an access token due to the flows we would like to have right now.
The thing is, while we can obtain the token without any problems, we cannot feed our keycloak instance in the front-end correctly with this token.
We tried init but it did not work correctly with various options we tried. (note that the keycloak instance should be empty when we want to feed it with the new token)
What we do is something like
keycloak.sessionId = request.data.session_state; keycloak.token = request.data.access_token; keycloak.refreshToken = request.data.access_token; keycloak.authenticated = true;
But it seems it does not trigger some internal logic of the Keycloak Instance and barely work.
We spent a lot of time looking for answer, and most of time we found unanswered questions, or nothing better than the solution above.
Any insight or help would be awesome!