我一直在尝试将zoho会议与我的应用程序集成(React是前端,django是后端)。
在获取访问令牌时,我会得到以下错误。
Access to fetch at 'https://accounts.zoho.com/oauth/v2/token?code=1000.53axxxxxxxxxxxxxxxxxxxxxxxxxx2e8e5eb43cfe53005f8d93490&client_id=1000.PGPL8RK7R54UR7JSNKTM2ZRETSF4CI&client_secret=xxxxxxxxxxxxxxxxxxx&redirect_uri=http://localhost:3000/app_store/zoho_meet&grant_type=authorization_code' from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
这是我的axios代码部分
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'Accept': 'application/json',
"Access-Control-Allow-Origin": "*",
}
})
const url = `https://accounts.zoho.com/oauth/v2/token?code=${zcode}&client_id=1000.xxxxxxxxxxxxxxxI&client_secret=92821f12d14cf11162891xxxxxxxxxxxxxxxxxxxx&redirect_uri=http://localhost:3000/app_store/zoho_meet&grant_type=authorization_code`
publicAxios.get(url)
.then((res)=>{
console.log(res)
})
.catch((err)=>{
console.log(err)
})
这里有人能帮我吗?我错过了什么步骤?
发布于 2022-10-17 23:31:31
我用Netlify的无服务器函数(AWS Lambda函数)从我的React应用程序连接到Zoho Api。我通过无服务器函数进行所有Api调用。在浏览器(客户端)中运行时,对Zoho的Api调用失败,出现CORS错误。它必须在服务器上运行。一个人也可以使用谷歌功能,但我还没有尝试过。Netlify文档很棒。
https://stackoverflow.com/questions/74078647
复制相似问题