How to resolve the invalid token error
I'm trying to integrate the Zendesk API into my application. I keep getting the "invalid_token" error each time I request the visitors' API endpoint to save users' contacts.
How do I resolve this, please?
Here's a sample of my code:
const encodedToken = Buffer.from(
'myTokenHere'
).toString('base64');
const config = {
method: 'POST',
data: {
email: 'example@example.com',
name: 'example name',
phone: '908256325365',
banned: false,
},
headers: {
'Content-Type': 'application/json',
Authorization: `Basic ${encodedToken}`,
},
};
axios(config)
.then(function (response) {
console.log('success', response.data);
})
.catch(function (error) {
console.log('error', error?.response?.data);
});
-
Hi Etiene! It looks like you got your answer in this post, but let us know if you need anything else.
Iniciar sesión para dejar un comentario.
1 Comentarios