Webrtc connection issue

i am following this documentation to implement a webrtc connection to stream video, but i am facing issues with token authorization i am seeing these messages in the textbox

Failed to retrieve token - TypeError: Failed to fetch

Failed to initiate WebRTC session - TypeError: Failed to fetch

Please try to enable to Developer Tools in your browser, this should give you more information about the issue. If it does not lead you to solve the issue try to share what it gives you.

hi,

this is what i am seeing in the dev tools

Access to fetch at ‘http://desktop-lq36vu4/api/REST/v1/WebRTC/Session’ from origin ‘http://localhost:3000’ has been blocked by CORS policy: Request header field authorization is not allowed by Access-Control-Allow-Headers in preflight response.

i have updated the appsettings.production.json like this

{

“CORS”: {

"Enabled": true,

"Access-Control-Allow-Origin": "\*",

"Access-Control-Allow-Headers": "Content-Type",

"Access-Control-Allow-Methods": "\*"

}

}

still getting cors error for starting the session

As we read it it is complaining that the header is not allowed.

Please try to put a star also for “Access-Control-Allow-Headers” in the json.

If it works with star, allowing all, and you want to limit it you will need to analyze what headers is being used.

I added * for “Access-Control-Allow-Headers” in the json, still getting the same error.

Is something wrong with my API Gateway? Or Am i missing something?..

Did you manage to find a solution?

It didn’t work for me either. But once I added the log level in the appsettings.production.json for some reason it worked..

{

“CORS”: {

“Enabled”: true,

“Access-Control-Allow-Origin”: “*”,

“Access-Control-Allow-Headers”: “*”,

“Access-Control-Allow-Methods”: “*”

},

“Logging”: {

“LogLevel”: {

 "Default": "Debug"

}

}

}

Wild guess. Maybe there was a flaw in the file and when you added logging it was better, maybe you didn’t restart the VideoOS ApiGateway AppPool in IIS doing the first change.

I believe this thread is on the same issue but with more info.. https://developer.milestonesys.com/s/question/0D5bH0000015aDgSAI/webrtc-integration

Actually I restarted the VideoOS ApiGateway AppPool in IIS. After that I tried literally 20 times, and each time I was getting the CORS error (when attempting to get the token). Once I added the log level and restarted the VideoOS ApiGateway AppPool, I was able to get the token and also get the live feed.