tomgross/pcloud

When trying to use 'listtokens' I get error 1000 'Login is required'

Closed this issue · 12 comments

I've successfully used the api for my script but when trying to determine and use the call listtokens to see if my tokens have expired or when they will expire, the api returns the following error:

{'result': 1000, 'error': 'Log in required.'}

I'm using oauth2 as my authenication. The listtokens command doesn't take any input: https://docs.pcloud.com/methods/auth/listtokens.html
To start my script off (as it's in it's beginning stage) I've written a 'list folders' function and that works fine. So it's not that I'm not logged in, it must be something else.

Any ideas?

The endpoint works fine (with username/password) authentication, if authenticated.

So do you mean that this function is only to be used with user/pass authentication and not oauth2?

No, that is not what I wanted to say 😉 .
There is no diifference on the method level for different authention mechanisms. I consider testing with username/password is as good as testing with oauth2. If there is a subtle difference between these two mechanisms (for the listtokens-method) it would be on pCloud side and not on the library side we can controll.

Any update on how to do this?
@ikwyl6 did you get it working?
I added these lines into api.py because I want to access the collections:

    def collection_list(self, **kwargs):
        return self._do_request("collection_list")

And I get the same result: {'result': 1000, 'error': 'Log in required.'}

@tomgross how did you test the listtokens endpoint? And does it work for you with oauth2? (And is there a reason for why it's not included in the repo?)

Bump? @tomgross @ikwyl6
EDIT: indeed this does work when logged in with username/password, but it does not work with oauth2

No haven't had any more info or gotten further on this. I honestly haven't looked at it since reporting this. I think the pycloud api call needs something added to it for oauth2 so it works correctly.

@ikwyl6 why do you think that? I couldn't find anything about additional required parameters for oauth2 in the pCloud API docs... (I didn't find much information on this anyways)

I suspect there is something wrong with your oauth2 authentication flow. Does any other method work with oauth2 for you?

Yes - I can upload files to pcloud using this flow..

I can reproduce this issue and wrote a test for it. I filed a request by pCloud to get some feedback on this issue.

oh great! thank you

Here is the answer of pCloud (in German) saying the listtokens endpoint is not allowed for oauth2:

Unsere Entwickler haben uns kürzlich mitgeteilt, dass die Methode "listtokens" für oauth2 nicht erlaubt ist. Dies ist der Grund für den Fehler.

I ask them to document it but there is nothing we can do about it.