I'm currently working on an odd project scenario. I currently have 2 servers, server A is used for authentication/sessions and to serve up multiple React applications, server B is simply an API for sending and retrieving data.
I have a javascript application that is walled behind a login screen so you can't access the app (and scripts aren't even loaded in) until after you authenticate via the server.
I need a way to authenticate via server A with a non javascript application, then after login, render the javascript application and pass the JWT to it to then be used for all future requests that are sent to server B. I also need to store a session on server A, so when the user refreshes the page, they still have access to the javascript application and don't have to login again.
The main thing I'm confused on is the proper way of handling this so users can refresh the page and still have access to the app, while also being able to have the JWT to make requests to the other server.