2

我无法使用 Node js 中的 Clockify API 添加新客户端。以下 axios 发布请求返回错误消息:“访问此资源需要完全身份验证”。但是,我可以使用具有相同 API 密钥的 axios.get() 方法获取客户端列表,所以我不确定为什么发布请求说我没有经过身份验证。请让我知道我错过了什么

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
});

}

4

1 回答 1

0

我遇到过同样的问题。再生API_KEY解决了它。

于 2021-12-28T15:25:42.097 回答