pCloud/pcloud-sdk-js

JS SDK "getfilelink" api does not work.

audiorecorder opened this issue ยท 9 comments

when i call "getfilelink" api on the web, An error occurs.

client.getfilelink(4130653400).then(function(resp){ });
https://api.pcloud.com/getfilelink?access_token=??????&fileid=4130653400&forcedownload=1
Error:
{result: 7010, error: "Invalid link referer."}

Please fix this problem.
and I also hope that the direct-download link supports CORS for XHR.

Hello,
This is not an issue with the SDK itself, but with the platform. Downloading files from the browser is not currently supported. Can you tell me more about your app and what you want to achieve?

Also, do you use other Cloud APIs and do you know how they work around this issue?

Hello,
I work with meteor js and I use Pcloud SDK in my project,
I can download the file on my server side, but how can I download file from my client side page

Thank you

How to play a video on web client? Received 7010 when using gethlslink.

This is not an issue with the SDK itself, but with the platform. Downloading files from the browser is not currently supported. Can you tell me more about your app and what you want to achieve?

That's really disappointing. An artificial limitation like this should be documented clearly, not left to be discovered when people have already made an investment in your tech on other platforms.

The problem (I had the same after long work time) is that the api creates links to download files/images/etc for a determinated IP, so if you generate the link (as I made) from your server side (the link is limited to the server IP), so if you try to consume the link from the client side (as also I made), it doesn't work, because are not available.

And yes is really disappointed that this restriction is not documented in any place, and also that you cannot disable it. For me worked fine for weeks that I only tried in localhost, and when I was ready to publish it, boom, it doesn't work.

I was actually generating download links and consuming them in the same place (I was using the API client in a SPA). If I ran it from localhost, everything worked well (and the API was nice and fast, too, unlike Dropbox), but I started getting "invalid referrer" errors when I tried to deploy anywhere else, indicating that it's not just a design issue but a deliberate, artificial restriction with an exception for local development and that it would have been less engineering to just allow browser clients to download files. That combined with the lack of documentation left a bad taste.

Hi,
Is there any workaround for the issue?

Seems, what we need is to be able to generate the link on behalf of the client IP at server level.
Can we pass the client IP in the request?
Can we ask for that feature?

Hello, This is not an issue with the SDK itself, but with the platform. Downloading files from the browser is not currently supported. Can you tell me more about your app and what you want to achieve?

Also, do you use other Cloud APIs and do you know how they work around this issue?

The example files seem to expect this to work -- see the download.html file in examples, though it, obviously, currently throws a CORS error (even after debugging the example). But it doesn't seem to expect to!

Use case: I would like to download music files and push their content into an audio tag, for example, to create a self-hosted player that doesn't require a middleware and can access pCloud directly.

And, you know, also so that the examples work as expected. ๐Ÿ˜‰