http://engineering.shapesecurity.com/2016/08/pokemon-go-api....
Basically sign your API requests with the most obscure function of phone context variables imaginable, and recognize that if you get so popular that it's cracked, you can just hire a machine learning team anyways. And pin your certs!
Apply a max threshold to check if a client is reasonably close to potential "co-located" clients.
You can't shrink physical distance. Pinging a server in a nearby US city is 13ms. Hong Kong is 232ms.
A much easier problem than "are you really where you say you are?" is "are you likely to be sending me fake locations?", which is hard to do with a single location update, but if the user is moving rapidly, or in geographically distant locations across multiple updates it's much easier to catch.
Do you have a user login system? Can you easily isolate fake data to a certain set of accounts? Or are you dealing with anonymous requests?
One possible solution you can look into is signature authentication of the headers to verify that the request is coming from a trusted source. You can either us a public/private key pair or a symmetric key with HMAC. That being said, this isn't foolproof - you have to keep the key secure, and that isn't totally possible in an app. If someone attaches a debugger they will be able to get your secret key if they're determined enough. The best you can do is obfuscate / encrypt the key so that it can't easily be read out from the strings in your app.
If you wanted to verify the location data itself, you could look into modeling the user's movements and look for abnormalities in the sequence of locations. Also, you can check the location against an API like Google or Foursquare on the back end.
Curious to hear what other people think as well.
Not to mention, most phones may not have those sensors.
[1] https://www.phonegg.com/list/303-Cell-Phones-with-Barometer
Also, pressure in vs outside can vary more than you'd think...
Barometers aren't very widely spread and I'd be wary of their calibration.
Might be tricky accounting for air travel but even then you could safely assume nobody's taking more than two flights a day and six a week or something like that
Make the user take a pic of the store, then check the EXIF for the timestamp. The pic should be very easy to shape-compare with other submissions of the same store (hardware doesn't move much, as opposed to faces), and the pic should never be exactly the same (refuse submitting twice the same pic).
Other solutions require the participation of the store: Dynamic QR codes, microphone authorization, or a website on the store's Wifi internal network.
The scale I'm thinking about is "Are you really in the store you say you're in?" where all users are from the same fairly dense city. So geolocating the IP isn't good enough. Accuracy to a city block or two seems good enough though.
My best idea so far is to submit a list of available wifi access points, and use that as a "password" to prove that you're where you say you are. If your list is 80% like the list of other users at that location, we trust you.
Unfortunately in iOS you can't get that list! It requires a private API, so calling that method will get your app rejected from the store.
Does anyone have any other ideas?