Kinvey.File.download response with empty _data property
a
adampax
started a topic
over 6 years ago
I'm trying to download a globally readable file, in this case a jpeg, with:
~~~
var promise = Kinvey.File.download('file-id', {
success: function(response) {
...
}
});
promise.then(function(response) {
var file = response._data;
});
~~~
But the response comes back with `_data:{}`;
Earlier, I was getting:
~~~
{"name":"InsufficientCredentials","description":"The credentials used to authenticate this request are not authorized to run this operation. Please retry your request with appropriate credentials","debug":""}
~~~
But got around that by setting `_acl.gr: true` as mentioned [here](https://support.kinvey.com/discussion/comment/201904976#Comment_201904976)
I also have `public:true`, but I believe that only applies to the downloadUrl. The url works fine.
Just to be clear, did you pass in the `gr` property as: `{ _acl: { gr: true } }`?
Anyway, are you using `console.log` to display the `_data`? Does this give you anything: `response._data.length`?
a
adampax
said
over 6 years ago
A ha!
Yes, I did pass the gr property, first by the way you mention, then trying
~~~
var acl = new Kinvey.Acl();
acl.setGloballyReadable(true);
//then
_acl: acl,
~~~
Which I'm assuming did the same thing.
Yes, I was looking at logs, and I guess I was expecting `TiBlob` or something similar. _data does have a length, and my problem was down the line where I was trying to read the blob data into the imageview.
adampax
~~~
var promise = Kinvey.File.download('file-id', {
success: function(response) {
...
}
});
promise.then(function(response) {
var file = response._data;
});
~~~
But the response comes back with `_data:{}`;
Earlier, I was getting:
~~~
{"name":"InsufficientCredentials","description":"The credentials used to authenticate this request are not authorized to run this operation. Please retry your request with appropriate credentials","debug":""}
~~~
But got around that by setting `_acl.gr: true` as mentioned [here](https://support.kinvey.com/discussion/comment/201904976#Comment_201904976)
I also have `public:true`, but I believe that only applies to the downloadUrl. The url works fine.
Am I missing something else?