I have a app that is served with spring-boot. I have added some controllers for "api/..."-calls that do different things the angular-frontend needs. How do I secure these urls so that only my frontend can reach examlpe.com/api/... and not every user? I don't want anyone to be able to reach examlpe.com/api/... from their browser but they should be able to reach example.com.
The url example.com/api/userinfo sends back information about the currently logged in user. Only my frontend should be able to make these calls.
I realise that some kind of authentication needs to be implemented for these calls. Do I send some kind of tokens when making calls to the api. What are the best practices?