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

pcloud Can't download file #6

Open
MilosDjonovic opened this issue Nov 14, 2018 · 8 comments
Open

pcloud Can't download file #6

MilosDjonovic opened this issue Nov 14, 2018 · 8 comments

Comments

@MilosDjonovic
Copy link

I've try example for download:
https://github.com/pCloud/pcloud-sdk-js/blob/master/examples/download.html
and it does not work.
When I clikc on "Get token", files are listed, but download button does not work.
Console.log:
Uncaught (in promise) {result: 7010, error: "Invalid link referer."}

@sorentycho
Copy link

See the other thread: #4 (comment)

@MilosDjonovic
Copy link
Author

I saw that.
I want to check that it is not possible to download the file with js sdk

@sorentycho
Copy link

From what I can tell looking through the code (and the error you recieved), the JS SDK is using the same HTTP API we've been trying. So I think, even though the SDK includes a browser module, it's not possible.

I'm porting my app to Dropbox, which I've just verified to allow file downloading in the browser on an arbitrary site. Dunno if that helps you or not.

@MilosDjonovic
Copy link
Author

It helps.
Thanks!

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

@igneosaur
Copy link

The issue is that the method downloadfile also uses the getfilelink method which "can't be used from web applications. Referrer is restricted to pcloud.com". See #4.

@ruffin--
Copy link

ruffin-- commented Sep 6, 2022

Yeah, it looks like that download.html file should've been removed. I got the token part working well (see this PR), but then ran into your run-of-the-mill CORS errors.

As @igneosaur remarks, getfilelink only works for pCloud.

This method can't be used from web applications. Referrer is restricted to pcloud.com.

You're going to need a proxy like what's mentioned here, but one you're hosting yourself, I believe.

@alensiljak
Copy link

I have a PWA app which gets access to its app folder only and is used to backup and (was hoping) restore the data and settings to/from pCloud.
This is pretty bad news, finding it out only once coming to the point where a download needs to be made from the app.
Subscribing to the issue in hope things improve (and soon).

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

6 participants