Keycloak-js: Manually set token


I’ve kind of ran out of places to ask, I’ve scrapped as much as the web as I possibly think I could haha. So this is one of my final hopes.

Currently, we’re (obviously) trying to do a unique implementation. We have a “partial” authenticated flow. What I mean by “partial” is there is a point in our flow were the backend will interact with keycloak, create an account, retrieve the access_token & refresh_token, and return it in a response to our react front-end.

At this point, I am attempting to set the access_token and refresh_token manually using the keycloak-js instance. When I do this, the set values work as expected (send authenticated requests to the BE). but, when i go to updateToken, the request fails with a 400 (as for some reason, the keycloak-js instance is removing the refresh token).

Note: We also want to authenticate via keycloak login and retrieve the tokens that way also.

My question; has anyone implemented this type of manual/standard process successfully? and if so, do you have any guidance you can spare?