Let's say I have an iOS/Android app which rely on a custom REST API for things such as account management (register, login, password reset, get/set user-related data).
There is no good way to guarantee my API is only called from my mobile application. Oauth2 and the like with 'secret' in the client code - can be easily reverse-engineered.
Let's say I have an API call like this:
https://www.myapi.com/register_user?username=UUU&password=PPP&email=EEE
(of course, not exactly like that but you get the idea)
This create a new user and from then all API calls will either include a session-token or something that ties the API call to a specific app user with an account.
This first registration call is the only one that is not protected by anything and what I'm worried about is that a malicious person calls it 1,000,000 times from a PC script to create lots of fake users, especially with real email addresses. People with these addresses won't be able to use the app.
So How to protect that very first API call to prevent mass misuse? I'm thinking of including a server-validated mobile-friendly CAPTCHA in the user registration form.
Again, all subsequent API calls are protected with session-token and API-call-count monitored per user (suspicious ones are blocked).
Does that make sense? Am I over-complicating things? Many Thanks
PS: It seems other interesting alternatives include using email-validation or a solid third-party identity provider like Google and the like - None of these 3 options is perfect. Anyway, interested in the discussion around this issue.