I am building a web page with ASP.NET Core and angular 8 (hosted together). I want to allow requests to my API only from SPA.
At this point, I think to create some kind of rule of hashing that only frontend and backend apps know. For every request I will calculate hash and put it in header of the request. After I receive request, I will calculate hash again and compare it to the hash provided in the header. If they match, then it's OK.
I am interested in how much secure is it and is there any way to hack it.
I am new to angular and I am also interested in if there is any possibility (in production mode) to write some kind of js code (by app user), which will call my 'send request' method (i.e not by clicking button).
EDIT:
I use standard jwt token based authentication in my app, so there is no possibility to access api resources if user is not authenticated. What I want to achieve is that authenticated app user (developer) should not be able to make request from other sources like postman, C# code, browser console for example.
I have some 'valuable' data and I want it to be visible only my web page. I want to eliminate stealing facts..