• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Using REST API for both Web and Mobile and Other Third party applications

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I am just starting new project. It will a website that has some offers.
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

Client (Guest)
1. Search
2. Book
3. Register
4. Subscribe
5. Refund

Airport companies
1. Add tickets
2. Change tickets
3. Get statistics
4. Delete tickets

Administrator
1. Manage other users (CRUD)
2. Change specific configurations
3. Configure third party services

Manager
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.
Thanks

 
Marshal
Posts: 4500
572
VSCode Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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).
 
Sergio Trevino
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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 ?
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic