azure-sdk-for-js
azure-sdk-for-js copied to clipboard
CORS error with Azure Communication Services SDK
- Package Name:
- "@azure/communication-calling": "^1.6.3", "@azure/communication-common": "^2.1.0",
- Package Version:
- Operating system:
- [x] nodejs
- version:
- node v18.8.0
- [x ] browser
- name/version:
- Google Chrome version 105.0.5195.127
Describe the bug A clear and concise description of what the bug is.
I am using the Azure Communication Services SDK for Javascript to create a voice call web app in Google Chrome following the quickstart:
https://learn.microsoft.com/en-us/azure/communication-services/quickstarts/voice-video-calling/getting-started-with-calling?pivots=platform-web
The code in question is as follows:
submitToken.addEventListener("click",` async () => {
const callClient = new CallClient();
const userTokenCredential = userToken.value;
try {
tokenCredential = new AzureCommunicationTokenCredential(userTokenCredential);
callAgent = await callClient.createCallAgent(tokenCredential);
}...
When I enter the user access token in input box in the browser, the AzureCommunicationTokenCredential is instantiated and I generate the following errors in the dev-tools console in Chrome:
sdk.bundle.js:109 ECS - Config fetch complete
sdk.bundle.js:109 ECS - Delaying User config fetch until we have a valid SkypeToken
sdk.bundle.js:109 ECS - Config fetch complete
synthesis.html:1 Access to XMLHttpRequest at 'https://edge.skype.com/trap/tokens' from origin 'null' 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.
sdk.bundle.js:92 GET https://edge.skype.com/trap/tokens net::ERR_FAILED
Expected behavior Typically this process would have no errors and would allow me to make a phone call as the user access token would have been validated.
Anyone have any ideas?
Label prediction was below confidence level 0.6
for Model:ServiceLabels
: 'Communication:0.52517945,Azure.Identity:0.44786534,Azure.Core:0.010602847'
Label prediction was below confidence level 0.6
for Model:ServiceLabels
: 'Communication:0.52517945,Azure.Identity:0.44786534,Azure.Core:0.010602847'
Hi @dstarn1 , can you please share more information - a request ( with headers ) would help - you can remove personal information if there's one ( IPs etc.. )
Hi @akania , apologies for the delay.
I had to reup my subscription so my errors have changed in the browser. Here is what now shows:
It seems like the errors with the SDK making the request to 'https://edge.skype.com/trap/tokens' is now successful with a 200 response but now I'm getting continuous errors about cookies seen below:

Not sure what to make of it. The only pending request is the websocket request with the following info:
