angular-snippets-rest-sample
angular-snippets-rest-sample copied to clipboard
Download file request returns cross-origin error
The following request to download a file returns an XMLHttpRequest cross-origin error.
GET me/drive/items/<file-id>/content
Planning to add a workaround that uses the downloadUrl property of the file, per this guidance. Something like:
createFile()
.then(function (response) {
var req = {
method: 'GET',
url: response.data['@microsoft.graph.downloadUrl'],
headers: {
Authorization: undefined,
SampleID: undefined
}
};
deferred.resolve($http(req));
})
.catch(function (error) {
deferred.reject({
setupError: 'Unable to create a file to download or download the file.',
response: error
});
})