hey guys I am currently writing a small NodeJS script that takes an email address and attempts to figure out which social networks a particular email is associated with.
Here is my code:
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}/`);
});
this is the error message I get Server running at http://127.0.0.1:3000/
{ status: 400, message: 'Access token supplied contains invalid characters' }
I am using the latest NodeJS version with Kali LInux, with the FullContact API. My question is, I did check if my api key contains invalid characters by running the dos2unix command and eliminating any possible white space so what is the cause of the error 400?
The steps I have taken so far:
Used bash to strip out all whitespace and the dos2unix command to eliminate any carriage returns. Then checked the api key under jwt.io to see if my API key is valid.
Your responses will be awesome.
The auth key you're providing to the API endpoint indeed contains invalid characters {
and }
.
Try again after removing them.
headers: {
"Authorization": "Bearer iWotm_auth_token"
}