SOLVED

Microsoft Stream CORS Error

Brass Contributor

Hi.

 

I get a list of microsoft stream video json with this url.

 

 

 

https://aaea-1.api.microsoftstream.com/api/videos?NoSignUpCheck=1&api-version=1.3-private&$top=10&$orderby=name&$expand=creator&$skip=0

 

 

 

 

 
I tried

 

 

 

 $.ajax({
            type: 'POST',
            headers: {
                'Access-Control-Allow-Origin': '*'
                , 'Access-Control-Allow-Credentials': true
                , 'Access-Control-Expose-Headers': 'Date, Server, Content-Type, Content-Length'
                , 'Access-Control-Allow-Methods': 'OPTIONS, GET, POST, HEAD'
                , 'Access-Control-Allow-Headers': 'Content-Type, User-Agent, If-Modified-Since, Cache-Control, Range'},
            url: "https://aaea-1.api.microsoftstream.com/api/videos?NoSignUpCheck=1&api-version=1.3-private&$top=10&$orderby=name&$expand=creator&$skip=0",
            async: true
        }).done(function (data) {
            console.log(data);
            console.log('asd');
        }).fail(function (data, textStatus, errorThrown) {
            console.log(data);
        });

 

 

 

 
But this causes errors.

 

 

 

Access to XMLHttpRequest at 'url' from origin 'my url' 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.

 

 

 

 

So I tried many ways. I changed the type to jsonp and crossdomain to true.
 
Then this time,,

 

 

 

 

jquery.min.js:2 Cross-Origin Read Blocking (CORB) uses MIME-form application/json to respond to cross-source 'url' has been blocked. For more information, visit https://www.chromestatus.com/feature/5629709824032768.

 

 

 

An error like this has occurred.

It looks like a failure, but the status is 200.

and error message :

TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them     at Function.invokeGetter

 

I have created my local

http://localhost:44375

 

It's really hard. I can't find a way. Help me please..

2 Replies
best response confirmed by BoHyun (Brass Contributor)
Solution

@BoHyun I think you have to wait for the official API to get that work. I have tried what you do from a Power Automate Flow with some tricks regarding authentication and that worked. Didn't tried it from an own app till now.

@Tomislav Karafilov 

 

Can you share your flow trick?  Trying to get authentication working...

1 best response

Accepted Solutions
best response confirmed by BoHyun (Brass Contributor)
Solution

@BoHyun I think you have to wait for the official API to get that work. I have tried what you do from a Power Automate Flow with some tricks regarding authentication and that worked. Didn't tried it from an own app till now.

View solution in original post