pCloud / pcloud-sdk-java

The official pCloud Java SDK repository
https://pcloud.github.io/pcloud-sdk-java/
Apache License 2.0
39 stars 14 forks source link

Cannot sign in on Android #8

Closed PhilippC closed 3 years ago

PhilippC commented 3 years ago

Users of my app are reporting for a while now that they cannot log in with pCloud anymore (https://github.com/PhilippC/keepass2android/issues/1257)

In order to find the reason for this I

I click the Authorize Button in the sample app and enter my pCloud credentials under login. After this, the button shows a spinning loading indicator and nothing happens anymore. No callback in the app is received (e.g. onActivityResult).

Is this a problem with pCloud or did I set up my app in a wrong way?

Gromchy commented 3 years ago

I called Pcloud and they haven't been very helpful. Basically they are saying it's a third party app so they can't confirm anything.

However, given that my other apps can access Pcloud, i would think that the problem could be on KP2A's side.

Edit: don't know if that helps but im on EU data region.

PhilippC commented 3 years ago

well this issue here is an issue with the sample app and not with KP2A. Thanks a lot for supporting me with this!

Gromchy commented 3 years ago

Sure. If you need me to do any testing or send any questions to Pcloud, let me know, since I'm a subscriber to their most expensive price plan.

GhengisKoan commented 3 years ago

As a longtime KeePass2Android user & new pCloud lifetime subscription customer, you have my full support as well. I just got done submitting a request to pCloud Support with a link to this. Hopefully it will help you get some traction.

PhilippC commented 3 years ago

it might be worth mentioning that according to https://github.com/PhilippC/keepass2android/issues/1257#issuecomment-751450079 this issue might depend on the user's plan/data server location.

Gromchy commented 3 years ago

Yes for example their google chrome extension does not work for EU data region. They told me they're working on it, but it's been an issue that has been here for more than a year as far as I'm aware.

zoltanmaric commented 3 years ago

Yes for example their google chrome extension does not work for EU data region.

For what it's worth - I tried logging in while connected to a VPN server in the US, it didn't make any difference. After pressing log in button, there's just an infinite spinner :worried:

Gromchy commented 3 years ago

ok so, from all the threads I have read and tests I have made, I have come to the following conclusion:

Pcloud mini app button does not work for anyone.

US data region clients can use https://webdav.pcloud.com/ But EU Data region clients cannot use webdav, whether HTTP or HTTPS.

Same problem with the Chrome extension, where only US data region clients can log in.

I am now 100% confident this is the problem.

edrik commented 3 years ago

EU data region clients can use https://ewebdav.pcloud.com/

Note the e prefix in the sub domain.

Gromchy commented 3 years ago

Well I have tried it and it does not work for me. Maybe because of 2FA.

edrik commented 3 years ago

True, if you enable 2FA you can't apparently use webdav 😞

But aside from that webdav/ewebdav works.

Gromchy commented 3 years ago

Sorry I have tried so many times. And this is still not working for me.

I know my password and login details and there is nothing else I can think of.

Edit: i have removed 2FA

Screenshot_20201231-213324_Keepass2Android

edrik commented 3 years ago

I have removed 2FA

Then that looks like a valid case to contact pDrive support.

But that's actually unrelated to this issue where the officially documented OAuth method provided by this Android SDK is not working, even as a simple sample app.

georgi-neykov-hub commented 3 years ago

@PhilippC , sorry for joining the discussion so late. There is an update to this project that will solve your current issue and will add a few missing features, most notably the support for different account locations. Please upgrade to version 1.2.0.

@lvhoang1 , this project is not related to the WebDAV support of the service, so please contact pCloud's support and report your issue.

Gromchy commented 3 years ago

@PhilippC , sorry for joining the discussion so late. There is an update to this project that will solve your current issue and will add a few missing features, most notably the support for different account locations. Please upgrade to version 1.2.0.

@lvhoang1 , this project is not related to the WebDAV support of the service, so please contact pCloud's support and report your issue.

I agree with you, but please check my previous comments, Pcloud has told me twice that it's up to Keepass2android's dev to fix it, not them.

georgi-neykov-hub commented 3 years ago

@PhilippC can you provide some feedback once you are able to update your project with the new version of the library? The version would also make the multiple account locations handling easier as the user's API endpoint will be reported on successful authorization.

PhilippC commented 3 years ago

@georgi-neykov-hub thanks a lot for the updated SDK! I updated my app to 1.2.0 and indeed the authorization new succeeds! Unfortunately, it still does not work: I get com.pcloud.sdk.ApiError 2094: Invalid 'access_token' provided. I suspect I need to set apiHost() when building the apiClient based on the locationId received when authenticating - is this correct or this there a built-in way for this?

PhilippC commented 3 years ago

ok, I found that AuthenticationData has an apiHost field which I am now passing to the ApiClient.Builder and it seems to work. Just for completeness, is there any documentation/example demonstrating if this is correct usage?

georgi-neykov-hub commented 3 years ago

ok, I found that AuthenticationData has an apiHost field which I am now passing to the ApiClient.Builder and it seems to work. Just for completeness, is there any documentation/example demonstrating if this is correct usage?

This is the correct usage indeed.

@PhilippC the documentation sites for all SDKs are published in a single place, thus requiring deployment of the whole pcloud.github.io site. I am trying to work out a more flexible way to publish documentation updates.

There will be more updates to the SDK in the following months as there is a discussion on deprecating ApiClient and the whole java-core artifact in favor of pcloud-networking-java which is complete networking stack which provides much more features and flexibility. The main stopper for now is the lack of (time, always :) ), more samples and my desire to add support for streamlined uploads and downloads.

Once the time comes only the android artifact (possibly renamed) will be actively developed. The java-core artifact will be left in maintenance mode, mostly updated when there are new versions of OkHttp's 3.12.x branch which will be supported by Square to the end of 2021. By then my team should have already prepared a migration path, documentation and samples and APIs covering the whole functionality offered by this project.

PhilippC commented 3 years ago

ok, thanks for the update!