I know that this question has been asked in various forms before. However, I'm not looking for the "use https" answer. I'm already using HTTPS and I'm not worried about the sensitivity of the payload being transmitted back and forth.
However, an iPhone application that I am working on is talking to a REST API that I have built (I have control of the application and server - so any suggestions are welcome).
I use the OAuth2 protocol for authentication, which means that my "API key" is a combination of a Client ID and Client Secret that only need to be transmitted to acquire an access_token
. After that, all requests are sent to the server using the access_token
and a header containing an HMAC of the request body (using the client secret as a key). The only reason for this addition was so that someone couldn't make API requests with JUST an access_token
.
The API that I'm talking to is going to be made public when I release the application. So I'm not necessarily worried about others being able to make API calls to it.
What I care about is:
- People being able to make API calls using my application's client credentials (which means that I can't detect on the server side that it didn't come from my application)
- People being able to abuse the additional scopes that my client ID will allow them to have, and traditional API users will not have
My guess is that there's not really a solution to this problem (other than using UIWebView and making a glorified webapp) but I thought I would ask around here anyway.
Can you all think of a way to protect the client ID/client secret if it needs to be consumed by the app?