Let's consider this project to be an application for booking airplane tickets.
Simple clients can just search for offers and buy a ticket.
Here are some use cases for different roles
1. Add tickets
2. Change tickets
3. Get statistics
4. Delete tickets
1. Manage other users (CRUD)
2. Change specific configurations
3. Configure third party services
1. Get reports
2. Get statistics
3. Export reports
The most important part is the frontend, where guest users can search for tickets. Administration part can be written in any way.
I hesitating between choosing a right way to implement this.
This service will have an API allowing other companies to consume it. Therefore it should be secured in some way. And in case of using API there should be some sort of token hardcoded on the frontend side.
As a result everyone after opening Debugger console in Chrome will be able to use API for free. In case of using traditional approach we can use sessions so it will be a little bit harder to replicate and in case of using post request with page reloading it will be even more problematic because someone have to parse html and so on.
I have reviewed some similar solutions, they are using REST API but with cookies authentication and XSRF tokens.
Generally, could you suggest what is a better way of building such kind of applications from the architectural perspective.
Ron McLeod wrote:Take a look at the approach in this post. It uses HMAC-based authentication based on a shared secret and the request's metadata/contents. The HMAC will be different with each request, and by using time as one of the factors, cannot be replayed (outside of the server's grace period).
Thank you so much for the answer.
So basically it is better to use REST API, so it will be more scalable and used from different clients.
Could you give any other advice on this matter from architectural point of view ?