I am attempting to develop a weather website project using NodeJS Express and Axios, integrating the OpenWeather API to retrieve current weather data. However, I’m encountering authorization issues despite activating the API key.
I have followed the documentation provided by OpenWeather to properly integrate the API into my NodeJS Express application. I have obtained an API key and made sure it is correctly included in the API request URLs. I’ve tested the API key activation by accessing the API directly through the browser, and it returns valid data.
I expect to successfully retrieve current weather data using the provided API endpoints. Specifically, I aim to fetch weather information for a given city using the /weather endpoint and for a specific location using the /onecall endpoint.
{"cod":401, "message": "Invalid API key. Please see https://openweathermap.org/faq#error401 for more info."}
{
"cod": 401,
"message": "Please note that using One Call 3.0 requires a separate subscription to the One Call by Call plan. Learn more here https://openweathermap.org/price. If you have a valid subscription to the One Call by Call plan, but still receive this error, then please see https://openweathermap.org/faq#error401 for more info."
}
Khadija Gharatkar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.