Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

navigators Geolocation API returns error 400-2 #13143

Closed
cwittenb opened this issue Jun 2, 2018 · 4 comments
Closed

navigators Geolocation API returns error 400-2 #13143

cwittenb opened this issue Jun 2, 2018 · 4 comments

Comments

@cwittenb
Copy link

cwittenb commented Jun 2, 2018

  • Electron Version: v2.0.1
  • Operating System (Platform and Version): OSX 10.13.4

Expected Behavior
navigator.geolocation.getCurrentPosition should return the position of the device used.

Actual behavior
If you try to get a devices location via the geolocation API, like:
navigator.geolocation.getCurrentPosition(function(r){console.log(r)}, function(e){console.log(e)});
It returns an error like this:

PositionError {code: 2, message: "Network location provider at 'https://www.googleapis.com/' : Returned error code 400."}
code: 2
message: "Network location provider at 'https://www.googleapis.com/' : Returned error code 400."
proto: PositionError
PERMISSION_DENIED: 1
POSITION_UNAVAILABLE: 2
TIMEOUT: 3
code: 2
message: "Network location provider at 'https://www.googleapis.com/' : Returned error code 400."

My network connection is fine, the same code works outside the electron container.

To Reproduce
Run the above in your electron dev console.

@welcome
Copy link

welcome bot commented Jun 2, 2018

👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.

To help make it easier for us to investigate your issue, please follow the contributing guidelines.

@cwittenb
Copy link
Author

cwittenb commented Jun 2, 2018

As other tickets show, this seems to have been working once: #1376 -> #2613
Would be great to be able to use it again, as IP based services are far too inaccurate.

Thanks, any help would be greatly appreciated!

@MarshallOfSound
Copy link
Member

@cwittenb Geolocation services are rate limited based on the GOOGLE_API_KEY you have set in your Electron app. If you don't have one set then you are using the default Electron one which everyone will be using. Your best bet is to generate and set your own GOOGLE_API_KEY env var in your app to ensure that you don't run out of API calls.

@cwittenb
Copy link
Author

cwittenb commented Jun 3, 2018

@MarshallOfSound : Sorry for bothering, but I was expecting a 403 in case I hit the limit. Thanks for your help - adding an API key fixed it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants