having CORS issue during chat API
Posted Jul 05, 2022
Hello Team,
I am using streaming API for live chat.
Streaming API:http:// https://developer.zendesk.com/api-reference/live-chat/real-time-chat-api/streaming/
Here is the code:
var WebSocket = require('ws');
var ws_client = new WebSocket(
'wss://rtm.zopim.com/stream', {
headers: {
'Authorization': 'Bearer {Auto_token}' ,
'Access-Control-Allow-Origin': '*' ,
'Access-Control-Allow-Headers': 'Origin, Content-Type, X-Auth-Token',
'Access-Control-Allow-Credentials': 'true'
}
}
);
Having below error in console:
Access to fetch at 'https://rtm.zopim.com/stream' from origin 'http://localhost:4567' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: Redirect is not allowed for a preflight request.
does anybody have an idea to resolve this?
Thanks,
Charmi
0
1
1 comment
Arpan Nagdeve
Hi,
We looked a bit further into the problem and it seems Access-Control-* headers were been added that's causing the failure. Is there any specific reason for adding these headers given our API documentation has no mention of these headers?
0
Sign in to leave a comment.