【问题标题】:openweathermap showing unauthorized with api keyopenweathermap 显示未经授权的 api 密钥
【发布时间】:2021-07-15 00:13:31
【问题描述】:

我有这个:

<script>
        function gettingJSON(){
            $.getJSON("http://api.openweathermap.org/data/2.5/weather?q=London&appid=",function(json){
                console.log(JSON.stringify(json));
            });
        }
</script>

当我运行它并查看我的控制台时,我得到了这个错误:

[Error] Failed to load resource: the server responded with a status of 401 (Unauthorized) (weather, line 0)

我的 api 密钥与 openweathermap 仪表板中的那个匹配,所以想知道它不能正常工作。也许我错过了一些东西。有什么想法吗?

【问题讨论】:

    标签: javascript openweathermap


    【解决方案1】:

    我认为您只需将您的 api 密钥放在查询字符串中即可。

    http://api.openweathermap.org/data/2.5/weather?q=London&appid=[HERE]
    

    此外,它需要几个小时才能激活并准备好使用。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-12-22
      • 2013-05-16
      • 1970-01-01
      • 2019-12-03
      • 2019-02-03
      • 1970-01-01
      • 1970-01-01
      • 2016-10-13
      相关资源
      最近更新 更多