Google People Api: Country Not Returned In Adresses Field
I am trying to get the authenticated user's country by specifying 'addresses' field in the People Api request as specified here. This is the code: router.post('/test_scope', (req,
Solution 1:
All fields on the address field are optional (see docs). This also includes the country. There is also no guarantee that the data is actually correct (the user can add invalid data to their google profile), so be careful about that and check for the verified
metadata (see docs).
That being said you could try using a geocoding API to get the country from the formatted address. This could be made by using a reverse geocoding query (Google Geocoding API documentation).
Also notice that there are other fields that may contain an address. For example locations
(see docs) can contain information about where they live.
Post a Comment for "Google People Api: Country Not Returned In Adresses Field"