Proxy keycloak-js refresh token requests

Hello!

In short: I’d like to proxy login/refresh token requests though my API, keycloak-js is used on client side.

Setup:
react apps with keycloak-js on frontend, nodejs app with keycloak-admin on backend.
Problem:
We’re running multiple UI apps and each one have it’s own configuration(keycloak url, realm, api url, etc) and switching between configurations is a pain point.
Possible solution:
Proxy login and refresh token requests through our API, that way we can “fix” keycloak url and realm, that way we’ll have less things to configure.

At this point I’ve got 2 questions:

  • Is this even valid approach or should I look for another solution?
  • If it is, is there a way to set specific url for keycloak-js library token refresh/redefine this logic?

Thanks in advance!