Let's say I have an iOS / Android application that relies on a custom REST API for things like account management (registration, login, password reset, getting / setting user-related data).
There is no good way to ensure that my API is only called from my mobile application. Oauth2 and the like with "secret" in the client code - can be easily reconstructed.
Say I have an API call:
https://www.myapi.com/register_user?username=UUU&password=PPP&email=EEE
(of course, not quite like that, but you get the point)
This will create a new user, and then all API calls will either include a session token, or something that links the API call to a specific application user with the account.
This first registration call is the only one that is not protected by anything, and it worries me that a malicious person calls him 1,000,000 times with a PC script to create many fake users, especially with real email addresses. People with these addresses will not be able to use the application.
So, how do you protect this very first API call to prevent massive abuse? I am going to include in the user registration form approved by the CAPTCHA server for mobile devices.
Again, all subsequent API calls are protected by the session token and the number of API call calls for each user (suspicious ones are blocked).
It makes sense? Am I complicating things too much? Thank you very much
PS: Other interesting alternatives seem to include using authentication or a reliable third-party identity provider such as Google, etc. - None of these 3 options is perfect. In any case, they are interested in discussing this problem.