大家。我遇到了一个问题,我找不到谷歌的答案。所以我问。
问题是当我尝试调用Zoom任何API时,我会遇到下面的错误CROS。我为此使用了代理服务器,但无法正常工作。所以我从anguler.json中删除了它。
Access to XMLHttpRequest at 'https://api.zoom.us/v2/users/La------77/meetings'
from origin 'http://localhost:4200' 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.
我正在设置'Access-Control-Allow-Origin:*'但不起作用。我配置了代理服务器,但它在 Zoom 网站上被重定向。
检查我的代码
fetchAllMeetings(){
let header = new HttpHeaders({ "Authorization": "Bearer "+this.CLIENT_TOKEN,
'Content-Type': 'application/json',
'Access-Control-Allow-Origin': '*' });
const requestOptions = { headers: header};
return this.httpClient.get('https://api.zoom.us/v2/users/LayQ----FTgmw/meetings',requestOptions).pipe(first(), catchError(this.handleError));
}
响应错误
API 调用
我为此设置了代理服务器...但由于我在缩放网站中被重定向而被删除。
src/proxy.conf.json
{
"*": {
"target": "https://api.zoom.us",
"secure": false,
"logLevel": "debug"
}
}
角.json
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "Zoom-Meeting:build",
"proxyConfig": "src/proxy.conf.json"
},