Overview:
My company has developed a rate-limited API. Our goal is twofold:
- A: Create a strong developer ecosystem around our product.
- B: Demonstrate the power of our API by using it to drive our own application.
Clarification: Why rate-limit at all?
We rate limit our API, because we sell it as an addition to our product. Anonymous access to our API has a very low threshold for API calls per hour, whereas our paid customers are permitted upwards of 1000 calls per hour or more.
The Problem:
Our rate-limited API is great for the developer eco-system, but in order for us to dogfood it we can't allow it to be restricted to the same rate-limiting. The front end of our API is all JavaScript, making direct Ajax calls to the API.
So the question is:
How do you secure an api so that rate-limiting can be removed where in the process in removing such rate-limiting can't be easily spoofed?
Explored Solutions (and why they didn't work)
Verify the referrer against the host header. -- Flawed because the referrer is easily faked.
Use an HMAC to create a signature based off the request and a shared secret, then verify the request on the server. -- Flawed because the secret and algorithm would be easily determined by looking into the front end JavaScript.
Proxy the request and sign the request in the proxy -- Still flawed, as the proxy itself exposes the API.
The Question:
I am looking to the brilliant minds on Stack Overflow to present alternate solutions. How would you solve this problem?