'Full authentication is required to access this resource' Clockify API with Node JS

447 Views Asked by At

I am unable to add new clients using the Clockify API in Node js. The following axios post request returns the error message: 'Full authentication is required to access this resource'. However, I am able to get a list of clients using the axios.get() method with the same API key, so I'm not sure why the post request says I'm not authenticated. Please let me know what I'm missing

async function addNewClient(clientName) {
return response = await axios.post(`${url}/workspaces/${workspaceId}/clients`, {
    data: {
        'name': clientName
    },
    headers: {
        'X-Api-Key': CLOCKIFY_API_KEY,
        'Content-Type': 'application/json',
    },
   
}).catch(function (error) {
    console.log(error.response.data.message);
    return
});

}

1

There are 1 best solutions below

0
kuklyy On

I had the same issue. Regenerating API_KEY solved it.