Bing网络搜索api密钥由于某种原因无效

时间:2017-11-21 13:32:16

标签: javascript node.js express bing-api

我正在开发图像搜索抽象层FreeCodeCamp项目,我获得了Bing Web Search API的API密钥,我已经安装了node-bing-api npm模块并添加了这样的密钥:

const Bing = require('node-bing-api')({accKey: "Key Here"});

然后我做了一个GET Request函数来测试API是否有效,这是函数:



app.get('/search/imagesearch/:searchTerm:offset?', (req, res, next) => {
    var searchTerm = req.params.searchTerm;
    var offset = req.params.offset;
    // Search With API
    Bing.images(searchTerm, {
        count: 10,
        offset: offset
    }, (err, res, body) => {
        console.log(body);
    });
});




它让我回答:

{ "statusCode": 401, "message": "Access denied due to invalid subscription key. Make sure to provide a valid key for an active subscription." }

我已经尝试了它给我的两个API密钥,我仍然收到相同的错误消息, 任何人都可以提出可能存在的问题吗?

0 个答案:

没有答案