嘿,伙计们,我现在正在写一个小NodeJS脚本,它使用电子邮件地址,并试图找出某个特定电子邮件与哪个社交网络相关。
这里是我的代码:
const http = require('http');
const fetch = require('node-fetch');
const hostname = '127.0.0.1';
const port = 3000;
const server = http.createServer((req, res) => {
res.statusCode = 200;
res.setHeader('Content-Type', 'text/plain');
res.end('Hello World\n');
});
fetch('https://api.fullcontact.com/v3/person.enrich',{
method: 'POST',
headers: {
"Authorization": "Bearer {iWotm_auth_token}"
},
body: JSON.stringify({
"email": "bart@fullcontact.com",
"webhookUrl": "http://www.fullcontact.com/hook"
})
}).then(res=>{
res.json().then(json=>{console.log(json);});
});
server.listen(port, hostname, () => {
console.log(`Server running at http://${hostname}:${port}/`);
});这是我让服务器在http://127.0.0.1:3000/上运行的错误消息
{ status: 400, message: 'Access token supplied contains invalid characters' }我使用的是最新的NodeJS版本,Kali LInux和FullContact API。我的问题是,通过运行dos2unix命令和消除任何可能的空白,我的api键是否包含无效字符,那么导致错误400的原因是什么?
我迄今所采取的步骤:
使用bash删除所有空格和dos2unix命令以消除任何回车。然后检查jwt.io下的api密钥,以查看我的API密钥是否有效。
你的回答会很棒的。
发布于 2018-03-23 06:23:59
您向API端点提供的auth键确实包含无效字符{和}。
移除后再试一次。
headers: {
"Authorization": "Bearer iWotm_auth_token"
}https://stackoverflow.com/questions/49443487
复制相似问题