Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JS SDK "getfilelink" api does not work. #4

Open
audiorecorder opened this issue Oct 23, 2017 · 9 comments
Open

JS SDK "getfilelink" api does not work. #4

audiorecorder opened this issue Oct 23, 2017 · 9 comments

Comments

@audiorecorder
Copy link

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.

@elanoism
Copy link
Collaborator

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?

@bundu1109
Copy link

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

@wangdaliu
Copy link

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

@sorentycho
Copy link

sorentycho commented Nov 16, 2018

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.

@SirMartin
Copy link

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.

@sorentycho
Copy link

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.

@igneosaur igneosaur mentioned this issue May 24, 2020
@goutick
Copy link

goutick commented Sep 27, 2020

Hi,
Is there any workaround for the issue?

@DCWizard
Copy link

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?

@ruffin--
Copy link

ruffin-- commented Sep 6, 2022

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. 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants