I'm implementing an authorization server for our Web API 2 RESTful API using Bearer tokens. To give some context, I am building an MVC web application as well as a PhoneGap mobile application (to be deployed to both iOS and Android) that will consume the RESTful API. I've done a lot of research on the subject, and understand I want to go with the authorization code flow for my MVC app (as the client secret will be kept safe), however, it is my understanding that I must use the implicit grant flow for the PhoneGap application, with it being a purely client side application it is assumed it cannot hold a secret.
With that said, I'm still fighting over my understanding of the security implications of the implicit grant flow. When executed in a browser, I understand it to be somewhat secure (by validating the redirect uri, short-lived tokens, etc). However, because PhoneGap will execute within its own browser instance (thus returning the token via hash fragment that I will need to parse), how does this lock down the API to only my PhoneGap client?
What's to stop a malicious hacker from simply stealing the client_id (embedded in the HTML/JS) and build their own PhoneGap application (or any other) and simply go through the implicit authorization/authentication process, thus spoofing the "approved" or "official" PhoneGap app? This problem does not seem specific to my API - does this mean this problem exists for all API's out there that implement the implicit flow (including the big players e.g. Facebook, Twitter, etc.)? How can I prevent this from happening, does it mean I have to deny/not implement the implicit flow? If so, how do I consume the API securely from my PhoneGap application?
Thanks!