Jack1424 / RealTimeWeather

A plugin that allows you to sync your Minecraft server's time and weather with the real world
https://modrinth.com/plugin/realtimeweather
GNU General Public License v3.0
5 stars 3 forks source link

The plugin says the API key is wrong, but it is correct. #1

Closed WeltensiedlerDE closed 1 year ago

WeltensiedlerDE commented 2 years ago

Is there maybe a problem with the country code DE and the german zip code 34134 instead?

Here is the error log:

[00:23:14] [Server thread/INFO]: [RealTimeWeather] Enabling RealTimeWeather v1.1.1
[00:23:14] [Server thread/INFO]: [RealTimeWeather] Starting...
[00:23:14] [Server thread/ERROR]: [RealTimeWeather] Error when getting weather information: API key incorrect
[00:23:14] [Server thread/ERROR]: [RealTimeWeather] Please check that the values set in the config file are correct
[00:23:14] [Server thread/INFO]: [RealTimeWeather] [DEBUG] Configuration error
[00:23:14] [Server thread/ERROR]: [RealTimeWeather] Disabling weather sync...
[00:23:14] [Server thread/INFO]: [RealTimeWeather] [DEBUG] Enabling metrics...
[00:23:14] [Server thread/INFO]: [RealTimeWeather] Started!

And here is my config. I have just replaced tie api key for posting here. On my server the config has a correct api key from openweathermap.org:

SyncTime: false
Timezone: 'America/New_York'
SyncWeather: true
APIKey: 'JUSTREPLACEDFORPOSTINGTHEISSUE'
ZipCode: '34134'
CountryCode: 'DE'
Debug: true

I have replaced all comments, because the markdown of the editor makes the font size really big.

Jack1424 commented 2 years ago

The configuration values seem to work for me. If you recently generated that API key, you might have to wait a bit (usually a couple of hours) before it becomes valid.

If you want to confirm whether it's a problem with the plugin or not, go to this address in any web browser: https://api.openweathermap.org/geo/1.0/zip?zip=34134,DE&appid=[YOUR_API_KEY] (replace [YOUR_API_KEY] with your API key)

If your API key is valid, you should get a response like this: {"zip":"34134","name":"Kassel","lat":51.2878,"lon":9.4705,"country":"DE"}

If it isn't, you'll get a response like this: {"cod":401, "message": "Invalid API key. Please see https://openweathermap.org/faq#error401 for more info."}

Please let me know if this solution works so I can help you out or close the issue.