I wrote a REST-API in Java and I got this API using Spring Security. The procedure is as follows:
- Frontend calls / login RestService in Backend
- Backend returns a token for an interface
- each time the REST API is accessed, the token must be placed in the header
This works fine, but I read that it is also possible (with Node.JS / Passport.js / Express.js) that a session object with a cookie inside can be moved out of the box without any custom code.
Now my question will be if there is a better approach, so the interface / client does not need to constantly set the token in the header for any request.
source share