nextcloud / android

📱 Nextcloud Android app
https://play.google.com/store/apps/details?id=com.nextcloud.client
GNU General Public License v2.0
4.16k stars 1.75k forks source link

Stuck in login loop #3623

Closed kvannotten closed 10 months ago

kvannotten commented 5 years ago

After the latest update of yesterday, I can no longer login. The app keeps redirecting me to authorize my account.

AndyScherzinger commented 5 years ago

so pinging @tobiasKaminsky and @rullzer since it seems to a LDAP related issue.

phu9Suop commented 5 years ago

Keeping this high again. Switched on one notebook from debian 9 to debian 10, now with debian deb nc desktop Version 2.5.1git. Works fine updated FP OpenOS twice in the meantime, and davx5, need to put user data and pw again , works fine switched on smartphone to app 3.7.0, no change, where are the data from previuos app which must be wiped ?? @RDominique The fact that nextcloud offers only licences > 50 users shall make me humble ? I am retired and cannot by 50 licences for my single user install. BTW I worked in 20 programming systems, it started with ALGOL and FORTRAN, a.s.on and I do not see a point in getting into android and the nextcloud app now in my life. OS is for everybody.

Beeez commented 5 years ago

Issue on my clients as well. Seems to be a global thing with IOS, Android and the Desktop app as well (all is good on chrome though). I had at first thought it could have been due to my loadbalancers and sticky session cookies used with two nextcloud servers. Does anyone else have a similar setup?

I am using LDAP as well. Id be happy to send logs out somewhere if it can help get some movement on this issue. I can say though that even when i try and login to the app with a non ldap account, that account also login and grant loops.

drkmccy commented 5 years ago

This issue has gotten so bad, we're thinking of abandoning Nextcloud. Is anyone actively looking at a fix?

pasichnichenko commented 5 years ago

Yesterday I just installed Nextcloud 3.7.0. After numerous updates it is STILL HAVE THIS ISSUE, and today it lost password. Then I did numerous attempts to login again, and login, and login, and login and after every entered correct password it asked me again and again to authorize. It is interesting to note, when I give incorrect password then app immediately say me the password is incorrect, but when I enter right password it continues to ask me again and again. Application is still unreliable and, thus, unusable. I removed nextcloud app again and advising everyone to do same. Even owncloud android app is not loosing auth tokens/passwords. I am using owncloud app for now. Guys, just switch to owncloud app and it will just work.

Beeez commented 5 years ago

Is there an available owncloud app that is not paid?

Guys, just switch to owncloud app and it will just work.

EDIT: Just attempted from f-droid owncloud app and it says "Precondition Failed" when i try and sign in to nextcloud. Edit 2: I checked another github issue for owncloud app and tried Owncloud Android version 2.8.0 and it worked and logged in perfectly the first time, no login loop and no "Precondition Failed" error. There are some other issues i see right now but that might just be because i am using an older app version, but at least login works.

pasichnichenko commented 5 years ago

Owncloud app from googleplaymarket is free, at least I didn't paid any cent.

I just checked nextcloud's other tickets with history of longstanging fighting with some "android" "accounts" or "logins" "manager" which creates some "accounts" for apps or anything and which is buggy. I dunno why this android account/login manager is angry on nextcloud app and hates it, but tonns of other apps, like telegram, owncloud etc., are working perfectly. I dunno what rocket science is implemented in nextcloud app, so after forking from owncloud codebase it just stopped working.

Beeez commented 5 years ago

Well, i may have fixed my login looping. I made some changes to my ssl certificates and it seems to be working for me in the normal nextcloud app. i may have been missing the intermediate certifications in my pem file that i was delivering with my HAproxy install that is infront of my nextcloud server. I tested with myself as well as a few other people and they were able to login. Google chrome never complained about the cert so i figured all was good, perhaps the android app is a bit more picky. I dont know if this helps anyone or not but i hope so.

edit: might have not been the full fix after all, still having this issue on some clients. Definitely could be session handling related?

drkmccy commented 5 years ago

Something is definitelly not right with the way the sessions are being handled: This is my phone and tablet, several sessions for each:

Screenshot 2019-07-31 at 21 46 23
Beeez commented 5 years ago

@derekblankmccoy Yeah the same happens for me too. Every attempt creates a new one.

Also partly scratch my last message, it seemed to have fixed it but a few others are still getting the login loop and a status code 401 every time it fails to login and loops again. Also just like @pasichnichenko if you put in the wrong password, it does tell you that the password is incorrect, so it is fully authenticating properly. Different owncloud apps still work though.

drkmccy commented 5 years ago

Related? https://github.com/nextcloud/server/issues/13431

LiloBzH commented 5 years ago

Hello

I'm new user of NextCloud and same bug for me ! Login loop with Android App ( version : 3.7.2) NC 16.0.4 Tel : Galaxy S9

teddy19 commented 5 years ago

This seems to not be a problem of how one logs in or a specific server version. With each new release of the app the number of people affected increases. So it has to do with something about logging in with a "new" or "updated" app. Deleting Cache and Data and/or reinstalling does not fix the problem.

It affected myself when updating to 3.7.2 with normal password and second factor as well as with an app-password. After a downgrade to 3.7.1 (F-Droid still has it) or an update to the latest F-Droid Dev-App the problem dissapears. (See also #4351)

As mentioned, #4290 could be a reason. I also get a new device for every try to login with an affected device. The Server-Log does not show any entries, the Nextcloud-Log provides only:

openssl_sign(): supplied key param cannot be coerced into a private key at _XXX_/apps/notifications/lib/Controller/PushController.php#121

But I had this before the update and everything was working. No other messages appear and the same message comes up after rollback to the previous app (3.7.1) that is working.

tobiasKaminsky commented 5 years ago

I always suspected that login loop is due to Android's problem of creating a new account, which would explain why this happens on new installations. But @teddy19 did an upgrade and there the account must already exist: can you check this is settings?

teddy19 commented 5 years ago

But @teddy19 did an upgrade and there the account must already exist: can you check this is settings?

Did your sentence get corrupted or do I just not understand what you're saying?

tobiasKaminsky commented 5 years ago

is -> in In settings of Android you should still see your Nextcloud account. Even when upgrade does not work, or is it vanished?

teddy19 commented 5 years ago

Sorry, had to check on another device. There, the account is still shown under the Android list of accounts. Its synchronisation is disabled, trying to enable it results in a "The synchronisation is experiencing problems at the moment" (freely translated) error.

tobiasKaminsky commented 5 years ago

Can you also try 3.8.0RC1 which is available via Google Beta program? There is a change that might fix it for people experience it only after upgrade to 3.7.2.

LiloBzH commented 5 years ago

Hi i install the Beta version now (after delete data of 3.7.2 version) and the RC1 version is ok for me after some tests. For exemple, if i close app, I do not have to login when I launch the app for information, I m new user so i never test before 3.7.2 version so i can compare !

stefanheijnen commented 5 years ago

For me this issue started with the latest update (3.7.2) on 2 devices (Planet Gemini - Android 7.1.1 and Xiaomi 9T - Android 9). I used to login with app tokens, gave me a login loop. Same for login with password. I deleted the app, data and NC account from both phones, reinstalled. Still a login loop.

I have logcat's available if dev's are interested.

I installed 3.8.0RC1 on both phones and everything works as expected.

My other phone (Xiaomi Redmi Note 5 - Android 9) doesn't have this issue with 3.7.2.

tobiasKaminsky commented 5 years ago

I have logcat's available if dev's are interested.

Yes, please attach them here :+1:

stefanheijnen commented 5 years ago

Here you go

logcatOutput9T.txt logcatOutputGemini2.txt

tobiasKaminsky commented 5 years ago

@stefanheijnen can you maybe also try this without limiting it to NC app? I suspect that Android itself will show a bit more. Also do you see the account in settings?

(will you by any chance be at our conf? Then we could debug this together…)

tobiasKaminsky commented 5 years ago

Reason why I ask is:

08-22 18:27:01.845 11979 12610 D OwnCloudClient #19: REQUEST GET /nextcloud/ocs/v1.php/cloud/user 08-22 18:27:02.202 11979 11979 D AuthenticatorActivity: Successful access - time to save the account 08-22 18:27:02.263 11979 11979 I Timeline: Timeline: Activity_launch_request time:35974768

So our App could logged in succesfully, but then something strange happens and the complete log will hopefully give us more info.

stefanheijnen commented 5 years ago

@tobiasKaminsky I do have a log from a few minutes earlier, collected at the (rooted) device itself (Planet Gemini), with nothing filtered. The above lines are present at the end of the log. I've pasted everything from that period at https://pastebin.com/G5p48GYZ

When I see that error, it is probably after I removed everything NC related on my phone and did a fresh install.

Sorry, I won't be at your conf :(

If you need more info, I can downgrade to 3.7.2 and continue as per your instructions.

sicherha commented 5 years ago

I, too, have hit this problem yesterday. I was able to work around it in the following way:

  1. Start the Nextcloud app.
  2. Press the back button twice. The login screen will flash briefly both times but reappear.
  3. Log in as normal.
DragonQ commented 5 years ago

I, too, have hit this problem yesterday. I was able to work around it in the following way:

  1. Start the Nextcloud app.
  2. Press the back button twice. The login screen will flash briefly both times but reappear.
  3. Log in as normal.

Thanks a lot, I was having this issue on a Huawei MATE 20 Pro and this worked for me. Not sure if it'll kick me off after rebooting the phone but the app seems to work fine for now after doing this.

norweeg commented 5 years ago

I was having this issue, but I just found that tapping "go back to the old login method" or whatever the verbiage is and logging in there fixes the problem for me (at least for now)

edit: it broke again after i logged in Nextcloud Talk which lacks the "old login method" option. The Nextcloud Talk login seemed to get hung up, but after i logged into the Nextcloud app again with the old method, it was fixed again and talk was able to see my conversations again too.

drkmccy commented 5 years ago

I was having this issue, but I just found that tapping "go back to the old login method" or whatever the verbiage is and logging in there fixes the problem for me (at least for now)

That’s right, this is session related. My personal opinion is that session and app token logins are clearly not stable and still beta. They should be optional.

Beeez commented 5 years ago

I was having this issue, but I just found that tapping "go back to the old login method" or whatever the verbiage is and logging in there fixes the problem for me (at least for now)

Using go back to the old login method works every time for me as well. It just sucks that you dont get that option until your login has already failed.

AndyScherzinger commented 5 years ago

It just sucks that you dont get that option until your login has already failed.

You always get this option (you just need to wait for 30 seconds on the web-login screen)

tobiasKaminsky commented 5 years ago

@stefanheijnen thanks for your log. This is the relevant part:

 D Surface : Surface::disconnect(this=0x7bb0682a00,api=1)
08-22 18:03:15.447 24074 24074 D WindowClient: Remove from mViews: DecorView@5dbc7fd[], this = android.view.WindowManagerGlobal@a005b9d
08-22 18:03:15.448 24074 24074 D AuthenticatorActivity: Successful access - time to save the account
08-22 18:03:15.456 24074 24074 E AuthenticatorActivity: Account Account {name=stfn@cloud.hijnn.net/nextcloud, type=nextcloud} was removed!
08-22 18:03:15.456 24074 24074 E AuthenticatorActivity: com.owncloud.android.lib.common.accounts.AccountUtils$AccountNotFoundException: Account not found
08-22 18:03:15.456 24074 24074 E AuthenticatorActivity:     at com.owncloud.android.lib.common.OwnCloudAccount.<init>(OwnCloudAccount.java:78)
08-22 18:03:15.456 24074 24074 E AuthenticatorActivity:     at com.owncloud.android.authentication.AuthenticatorActivity.updateAccountAuthentication(AuthenticatorActivity.java:1632)
08-22 18:03:15.456 24074 24074 E AuthenticatorActivity:     at com.owncloud.android.authentication.AuthenticatorActivity.onAuthenticatorTaskCallback(AuthenticatorActivity.java:1500)
08-22 18:03:15.456 24074 24074 E AuthenticatorActivity:     at com.owncloud.android.authentication.AuthenticatorAsyncTask.onPostExecute(AuthenticatorAsyncTask.java:100)
08-22 18:03:15.456 24074 24074 E AuthenticatorActivity:     at com.owncloud.android.authentication.AuthenticatorAsyncTask.onPostExecute(AuthenticatorAsyncTask.java:43)
08-22 18:03:15.456 24074 24074 E AuthenticatorActivity:     at android.os.AsyncTask.finish(AsyncTask.java:667)
08-22 18:03:15.456 24074 24074 E AuthenticatorActivity:     at android.os.AsyncTask.-wrap1(AsyncTask.java)
08-22 18:03:15.456 24074 24074 E AuthenticatorActivity:     at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:684)
08-22 18:03:15.456 24074 24074 E AuthenticatorActivity:     at android.os.Handler.dispatchMessage(Handler.java:110)
08-22 18:03:15.456 24074 24074 E AuthenticatorActivity:     at android.os.Looper.loop(Looper.java:203)
08-22 18:03:15.456 24074 24074 E AuthenticatorActivity:     at android.app.ActivityThread.main(ActivityThread.java:6293)
08-22 18:03:15.456 24074 24074 E AuthenticatorActivity:     at java.lang.reflect.Method.invoke(Native Method)
08-22 18:03:15.456 24074 24074 E AuthenticatorActivity:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1084)
08-22 18:03:15.456 24074 24074 E AuthenticatorActivity:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:945)

This means that the app password was retrieved and the account can be stored within Android. According to the code (updateAccountAuthentication) you already had an account? And then for unknown reason the account could not be found.

@stefanheijnen can you do this (sorry it might be the same result, but to rule out everything):

tobiasKaminsky commented 5 years ago

Using the old login mechanism might work, but then you do not have push notifications, as those require the app token system.

drkmccy commented 5 years ago

Using the old login mechanism might work, but then you do not have push notifications, as those require the app token system.

What good are push notifications if you can’t login? 😂

tobiasKaminsky commented 5 years ago

Using the old login mechanism might work, but then you do not have push notifications, as those require the app token system.

What good are push notifications if you can’t login?

Hehe, I just wanted to point out that the "new" login system is the future and why the old one does not work in all scenarios. So instead we should try to find out why it does not work under some circumstances for some users. (some as we have more than 370k active installations)

KarelWintersky commented 5 years ago

Same issue. Infinite login screens.

KarelWintersky commented 5 years ago

'new' login system is bad solution. It is broke normal app functionality.

C0rn3j commented 5 years ago

I've a slightly different issue, I can login fine, but if I try to add a second account, the first one gets logged out.

https://www.youtube.com/watch?v=9CU1jxWeyXk

Using 3.7.2 from f-droid on Redmi 9T - https://f-droid.org/repo/com.nextcloud.client_30070290.apk

DragonQ commented 5 years ago

I've a slightly different issue, I can login fine, but if I try to add a second account, the first one gets logged out.

https://www.youtube.com/watch?v=9CU1jxWeyXk

Using 3.7.2 from f-droid - https://f-droid.org/repo/com.nextcloud.client_30070290.apk

Yes I have this problem in addition to the one most people are talking about in this thread. It's probably related.

millsaj commented 5 years ago

I had the same issue (or at least the same symptoms). This comment fixed it https://github.com/nextcloud/server/issues/13431#issuecomment-456453585.

phu9Suop commented 5 years ago

Hi, I commented above on having the same problem. After some analysis I found that it must have been an android-system side user database, which is full of failed trials to logon. Unfortunately the way to purge this user database from bad entries is difficult or impossible. I don't want to study sqlite because of this. The FACTORY RESET of my Fairphone2 resulted in an immediate success of making the app work. However it was 8 hours of work, to get the phone set up almost as before. including repeating of OS update. The cause of the many failed trials seems to be a problem with android, which has an option to install an external sdcard as internal, however not all apps on the Fairphone2 Open OS (7.1.2) handle this. Some apps did work from the sdcard, others not and nextcloud belongs to the latter. So I selected the sdcard to be external after the factory reset.

Fairphone# corrected

Beeez commented 5 years ago

I had the same issue (or at least the same symptoms). This comment fixed it nextcloud/server#13431 (comment).

This has always been in my config and does not fix my issues unfortunately.

tdm4 commented 5 years ago

Reverting to old login method fixed my issue.

bhelm commented 5 years ago

had the same problem, reinstall 3.7.2 did not fix. now upgraded to 3.8.0 RC4 and the login works again.

Beeez commented 5 years ago

had the same problem, reinstall 3.7.2 did not fix. now upgraded to 3.8.0 RC4 and the login works again.

RC4 has no change for me.

tdm4 commented 5 years ago

3.8.0 RC5 works on my phone.. no login loops, no issues after first setup. I might add, you'll have to remove the Nextcloud account from your phone first completely. (You're removing the account from your phone, not the nextcloud server itself) Then set it up again and it should work on 3.8.0 RC#

C0rn3j commented 4 years ago

I've a slightly different issue, I can login fine, but if I try to add a second account, the first one gets logged out. https://www.youtube.com/watch?v=9CU1jxWeyXk Using 3.7.2 from f-droid on Redmi 9T - https://f-droid.org/repo/com.nextcloud.client_30070290.apk

Re-tested with 3.8.0 from Play store and still the same. Tried removing the account from the phone first too.

stale[bot] commented 4 years ago

This request did not receive an update in the last 4 weeks. Please take a look again and update the issue with new details, otherwise the issue will be automatically closed in 2 weeks. Thank you!

C0rn3j commented 4 years ago

Nor did it receive attention. Not stale.

AndyScherzinger commented 4 years ago

If it doesn't get any attention as in new infos then it is stale actually.

As for adding multiple accounts, please upgrade to 3.8.1