SecUSo / privacy-friendly-weather

Privacy Friendly App for Android that can display weather for cities.
GNU General Public License v3.0
114 stars 29 forks source link

Custom API key are not immediately activated #150

Closed kousu closed 3 years ago

kousu commented 3 years ago

I just updated Privacy Friendly Weather today. When I started it, it prompted me to sign up for my own API key. I did. Here are two keys that should be valid:

However, once I put them in, I got a Toast saying

Error while updating Forecast, please try again!OneCallAPI

I got this email from them:

Dear Customer!

Thank you for subscribing to Free OpenWeatherMap!

API key:

  • Your API key is d37bef1a1b85598c8cb050781c421ffb
  • Within the next couple of hours, it will be activated and ready to use
  • You can later create more API keys on your account page
  • Please, always use your API key in each API call

Endpoint:

  • Please, use the endpoint api.openweathermap.org for your API calls
  • Example of API call: api.openweathermap.org/data/2.5/weather?q=London,uk&APPID=d37bef1a1b85598c8cb050781c421ffb

If I try their example, it fails:

curl 'api.openweathermap.org/data/2.5/weather?q=London,uk&APPID=d37bef1a1b85598c8cb050781c421ffb'
{"cod":401, "message": "Invalid API key. Please see http://openweathermap.org/faq#error401 for more info."}

Presumably this will start working in a couple of hours, but in the meantime it leaves me as a user anxious and unsure if I've made a mistake. Making an account to get an API key is already difficult enough for most people. Privacy Friendly Weather could pass up the 401 error in a more friendly way by:

a. validating the format locally b. suggesting "perhaps your API key is not yet activated?"

Version: 2.4.1 from F-Droid.

kousu commented 3 years ago

Actually it started working within a few minutes!

$ curl 'api.openweathermap.org/data/2.5/weather?q=London,uk&APPID=d37bef1a1b85598c8cb050781c421ffb'
{"coord":{"lon":-0.1257,"lat":51.5085},"weather":[{"id":501,"main":"Rain","description":"moderate rain","icon":"10n"},{"id":301,"main":"Drizzle","description":"drizzle","icon":"09n"}],"base":"stations","main":{"temp":276.89,"feels_like":273.18,"temp_min":276.48,"temp_max":277.15,"pressure":1000,"humidity":93},"visibility":2900,"wind":{"speed":3.09,"deg":110},"rain":{"1h":1.54},"clouds":{"all":90},"dt":1612225140,"sys":{"type":1,"id":1414,"country":"GB","sunrise":1612251430,"sunset":1612284673},"timezone":0,"id":2643743,"name":"London","cod":200}

So it's not that big of a deal in the end. Still, it was long enough that I thought there was a bug or that I'd made a mistake.

sleep-yearning commented 3 years ago

A special Toast is now shown when 401 error is received, noting the possibility of delay when freshly created. The length of the key is actually tested when put in the dialog and the tutorial, but not the settings view (so it is still possible to insert anything, if your key should be different). All keys I have seen are 32 characters long, but there is not really a guarantee for this.

fuhrmanator commented 3 years ago

I came here to say I got the same error as OP. I don't see any special toast mentioned by @sleep-yearning. It's not a huge issue, but an error to say keys sometimes take some time to be active would be useful.

sleep-yearning commented 3 years ago

There is a special toast for the case of a non-accepted key. This also tells you that it can take minutes to hours for the activation of new keys. Did this not display?

fuhrmanator commented 3 years ago

There is a special toast for the case of a non-accepted key. This also tells you that it can take minutes to hours for the activation of new keys. Did this not display?

No, I only got a toast about a key failure, with a short message with something about OpenAPI (unfortunately I didn't take a screenshot). I'm on Android, if that matters.

Edit: This is exactly what I got, and is what the OP posted (I had googled the error and it's how I found this thread):

Error while updating Forecast, please try again!OneCallAPI

sleep-yearning commented 3 years ago

Yes, I think this modification was done after the latest release. It should be explained in the new 3.0 release.

kousu commented 3 years ago

Thanks for fixing that up @sleep-yearning !!

I really like this app. It's clean and tight and the widget is nice.

kousu commented 3 years ago

Just want to say again that I appreciate the new message. It gives a lot more guidance after resetting my phone than before:

a