I was using http://code.google.com/p/google-api-php-client/

I was getting (401) Invalid Credentials exception. After googling for 2-3 hours found out that

  1. had developer key wrong
  2. logged in user had not enabled location api though https://www.google.com/latitude/b/0/history  – this cause  (403) Access Not Configured
  3. Following Scopes were not added
https://www.googleapis.com/auth/latitude.current.city Access to current location at city granularity.
https://www.googleapis.com/auth/latitude.current.best Access to best-available current location.
https://www.googleapis.com/auth/latitude.all.city Access to current location and location history at city granularity.
https://www.googleapis.com/auth/latitude.all.best Access to best-available current and past locations.