Can';我没有授权Axios post请求RaindropAPI
我正在尝试为我的一个雨滴收集构建一个简单的获取应用程序,并将其显示在一个项目中 我正在使用一个“测试令牌”,所以我现在不必做所有的授权工作 所有信息(访问令牌、集合id)都显示良好Can';我没有授权Axios post请求RaindropAPI,api,request,axios,http-post,Api,Request,Axios,Http Post,我正在尝试为我的一个雨滴收集构建一个简单的获取应用程序,并将其显示在一个项目中 我正在使用一个“测试令牌”,所以我现在不必做所有的授权工作 所有信息(访问令牌、集合id)都显示良好 useEffect(() => { if (accessToken !== null) { const headers = { Authorization: `Bearer ${accessToken}` }; axios.pos
useEffect(() => {
if (accessToken !== null) {
const headers = {
Authorization: `Bearer ${accessToken}`
};
axios.post(
`https://api.raindrop.io/rest/v1/collection/${COLLECTION_ID}`,
{ headers: headers }
).then(console.log).catch(console.log);
}
},[])
我注入的头显示在https中的请求负载中
但响应只是显示未经授权的
是否有人尝试过这样做,并且可以帮助我
谢谢 根据Axios post请求,第二个参数是body,第三个参数是headers 将您的请求更改为
axios.post(
`https://api.raindrop.io/rest/v1/collection/${COLLECTION\u ID}`,
{},//自post请求以来的请求正文。
{headers:headers}
).then(console.log).catch(console.log);