Hey, I’ve just started coding the weather application, however I ran into a couple of questions:
The navigator.geolocation only works on secure connections, so I can’t work with in locally, I thought about doing an extra request to an API to get the client IP and then send that IP to another API which returns the Geolocation, and then, I can use the darksky API, but I’m not too sure about this approach.
i’ve actually never had problems using geolocation in local development (just tested in Chrome and Safari to confirm). It seems that localhost is whitelisted.
Personally, while location via IP can satisfy the project, I feel like it’s a less desirable method, as a user’s IP location may be inaccurately recorded. See my post above for a workaround (though it doesn’t take into account the difficulty of working locally…)
I’m using the Dark Sky (Forecast.io) API, as I said before, I’m able to perform a request from localhost using Postman, but I can’t manage to do it from the browser, I have tried using both, axios and the native fetch API.
Sadly, I’ve already tried that, but the error is still there, I think it’s worth mentioning, the error happens with both, Chrome and Firefox (haven’t tried any other browser).
I guess I’ll look for another API, Dark Sky seems to bring nothing but trouble, in order to use it I’d have to setup a proxy https://darksky.net/dev/docs/faq#cross-origin too much trouble for simple data.