I keep receiving this error
Error: Authentication failed at IncomingMessage.
And this is snippet of my code in the server.js file :
var aylien = require("aylien_textapi");
var textapi = new aylien({
application_id: process.env.API_ID,
application_key: process.env.API_KEY
});
app.get('/test', (req, res) => {
textapi.sentiment({
text: 'John',
}, function (error, response) {
if (error === null) {
res.status(200).send(response)
} else {
console.log(error)
}
});
})
I have added the app id and key correctly but the response is always Authentication failed , didn't find an answer so far so had to create a question for it.
and i use this code on client side to trigger the server response :
fetch('http://localhost:8081/test')
.then((res) => {
console.log(res)
return res.json()
})
.then(function (data) {
console.log(data)
document.getElementById('results').innerHTML = data.message
})
Via Active questions tagged javascript - Stack Overflow https://ift.tt/2FdjaAW
Comments
Post a Comment