Chrome navigator.geolocation.getCurrentPosition() error 403
Asked Answered
S

3

36

For some reason suddenly when calling navigator.geolocation.getCurrentPosition() I get this error:

Network location provider at 'https://www.googleapis.com/' : Returned error code 403.

It used to work perfectly yesterday! Could there be anything with their servers??

Serdab answered 1/9, 2015 at 10:36 Comment(8)
I am experiencing the same problems in Chrome and Firefox but seems to work find in IE. Tried it on a colleague machine and getting the same results.Nunley
Happens for me too. I suspect that google changed somthing in their geo location policy over non secure httpInitial
Same problem here. Everything ok yesterday Aug 31 2015.Kanara
thank god it is not just meBanff
Same probleme here...chrome error 403...safari tiemout expired jsfiddle.net/mhj82/38Customable
possible duplicate of In new chrome (44.0.2403.157) geolocations doesnt worksLebna
Looks like it was solved at googleapis.comCustomable
The problem occurs again, Chrome Version 56.0.2924.87 (64-bit)Comment
A
14

It appears it is back up now. But before I realized it was working, I used another way to get location data as recommended by another user on reddit.com

var latLong;
$.getJSON("http://ipinfo.io", function(ipinfo){
    console.log("Found location ["+ipinfo.loc+"] by ipinfo.io");
    latLong = ipinfo.loc.split(",");
});

Source: https://www.reddit.com/r/webdev/comments/3j8ipj/anyone_else_had_issues_with_the_html5_geolocation/

Actable answered 1/9, 2015 at 18:39 Comment(2)
This appears to be unreliable, I'm showing up in richardson texas, which is news to me, since I'm in SF. Sorry for being snarky.Beckham
This just looks up the current IP in big geoIP tables - specially on mobile devices this is not the best way (GSM IP's are Pool-IPs, and GPS is much more accurate)Holdback
I
1

This happens for me too on idoco.github.io/map-chat

I suspect that this is related the the changes google planed for Deprecating Powerful Features on Insecure Origins it seems that some changes were done in the last few days in this chromium Issue 520765: Deprecation and removal of powerful features on insecure origins

Can you test your site over https to confirm that?

In the meanwhile I found this api usage as a workaround on this repo:

  $.getJSON("http://ipinfo.io", function(doc){
    var latlong = doc.loc.split(",")
    setUserLocation(parseFloat(latlong[0]), parseFloat(latlong[1]));
    getLocation(parseFloat(latlong[0]), parseFloat(latlong[1])).then(function(res){
      userLocationName = res
    })
    initialiseEventBus();
    map.panTo(userLocation);

  }, function(err) {
    setUserLocation(Math.random()*50, Math.random()*60);
    userLocationName = "unknown.na"
    initialiseEventBus();
    map.panTo(userLocation);
  })
Initial answered 1/9, 2015 at 11:30 Comment(3)
localhost is defined as secure here: Prefer Secure Origins For Powerful New Features but still doesn't work too...Director
Tried both Http:// and Https:// on internal and external sites with no change in results (Fails in Chrome/FF works in IE. Tried it in fiddler with a standard http:// head and it worked.Nunley
we’re using https and this still happensSerdab
S
0

I had the same issue, you have to check your developer dashboard and make sure that your API key has no usage restrictions or warnings.

Symmetrize answered 4/4, 2017 at 7:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.