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

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

Closed
ikwyl6 opened this issue Jul 18, 2022 · 12 comments
Closed

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

ikwyl6 opened this issue Jul 18, 2022 · 12 comments

Comments

@ikwyl6
Copy link

ikwyl6 commented Jul 18, 2022

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?

@tomgross
Copy link
Owner

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

@ikwyl6
Copy link
Author

ikwyl6 commented Oct 23, 2022

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

@tomgross
Copy link
Owner

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.

@Finni123
Copy link

Finni123 commented Nov 20, 2022

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?)

@Finni123
Copy link

Finni123 commented Mar 14, 2023

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

@ikwyl6
Copy link
Author

ikwyl6 commented Mar 14, 2023

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.

@Finni123
Copy link

Finni123 commented Mar 14, 2023

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

@tomgross
Copy link
Owner

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

@ikwyl6
Copy link
Author

ikwyl6 commented Mar 19, 2023

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

@tomgross
Copy link
Owner

tomgross commented Apr 3, 2023

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

@ikwyl6
Copy link
Author

ikwyl6 commented Apr 7, 2023

oh great! thank you

@tomgross
Copy link
Owner

tomgross commented May 6, 2023

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.

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

3 participants