Is there any way to use Google’s API to retrieve a user’s current zipcode without explicitly asking them for permission? I understand Google now uses OAuth 2.0 which is an authentication protocol where a user must allow permission to a particular service. However, I would like to find a user’s location without having to ask them!
Is this possible? I’m not interested in translating IP addresses as they typically return incorrect results. Likewise, HTML5’s geolocation feature would not work as it too requires user permission.
You will definitely have to oAuth a user using Google (or Facebook … or [insert social network here]) in order to gain access to any information (such as home or work “zipcode”) about that user stored on a 3rd party site. But once authenticated, you wouldn’t get a user’s current zipcode or location. Do you want their current location or their home address or their work address – you may want to clarify. Anyways, if you want a user’s current location I would suggest using the HTML5 geolocation API.
The simplest use of the geolocation API looks like this:
That has no detection, no error handling, and no options. Your web application should probably include at least the first two of those. To detect support for the geolocation API, you can use Modernizr:
Resources for HTML5 geolocation: