Skip to content

Developer Guide

vivekweb2013 edited this page May 25, 2022 · 2 revisions

FAQ

  • Why are we setting oAuth2.github.redirecturl config to http://localhost:3000/api/v1/oauth2/github/callback instead of http://localhost:8080/api/v1/oauth2/github/callback which has actual backend host and port?

    After the authentication on github completes the callback api is hit. In response of the callback api call we send a html response payload containing a javascript function that sets the token in local storage & redirects (using javascript) to / i.e. root location. So if we use backend redirect url, the javascript redirection will route us to http://localhost:8080 causing 404. To avoid this we have setup proxy in our frontend react application to route all the calls(ajax/non-ajax) having path prefix /api/v1 to be proxied to backend api server i.e. localhost:8080

    This is why we redirect to http://localhost:3000/api/v1/oauth2/github/callback so that javascript will route us to / which results in http://localhost:3000 and since ui is served from this location we get the home page on browser.

    This is a hack only for development environment. Since on kubernetes production instance the host for both api and ui is same. The ingress controller routes the ui and api requests to appropriate pod using configured rules

Clone this wiki locally