Actual state
I have REST API and React JS application that communicates with this API. In the API there are some public endpoints - for user registration, processing lost password etc. And I am looking for a solution how to restrict access to these public endpoints only from my React JS application because anybody who knows these endpoints can do requests and create user accounts and do in the system what should not do.
I have some ideas but all of them have some security flaws:
access token - every application will have own access token that will pass with all its requests to confirm to get an access to the API. But this is a problem, because if is it a frontend JS application token needs to be saved in JS code and end user can get this token and do requests it his own way.
limits - limit bad requests and count how many particular application (identified by its token) did a bad request. If there is too much bad requests, disallow access for the application to the API. But this is a problem, because one user can block all other users from one particular application (if he gets an application token and do requests in its own way).
Question
Is there some way how to solve this problem?