I have two separate servers, an nginx for the frontend and nodejs for the backend, running on the same machine. The frontend is available via https and is authenticated using auth0. I have created an tenant and a single page application and set the audience, callback url, etc.
The authentication via the frontend works well.
The backend is accessible via a reverse proxy (using the same nginx server) on /api, which forwards the requests to localhost.
Since I use a reverse proxy, the backend is available also directly by calling /api and therefore, is not secure.
I am passing the auth0 cookies (I am using Username-Password-Authentication) to the server.
How can I ensure that the calls to the backend (running express.js) originated by an authenticated user? What should be added to the backend in order to support that?
Thank you.