Android Client login fails with 401

Making a new post since the other one i posted in was too old (Android nextcloud app | access failed: operation finished with http status code 401). @j-ed mentioned it could be Auth but i dont believe it is.

I get a popup when logging in via the Android application saying http status code 401.

I am fairly certain this is not a Authentication problem since if i put in the wrong password, it just says incorrect password. The only time the http status code 401 ever comes up is when i put the right one in. I have this issue as well as login looping.

I log in, Grant Access, Get http status code 401, then back to login.
If i login using old method, it works fine and i get no error and it successfully logs me in.

I’m not sure all of what I need to provide to give a good indication as to where the problem lies and what the fix is.

Here is one section from logs. I dont understand why it is saying this when the credentials are correct and they work when using old login method.

I have two nextcloud servers behind a loadbalancer.

Login works on desktop in Chrome Browser, Login works on my Android Chrome Browser. Login fails in Nextcloud app.

{"reqId":"jfDwBLetqFDdrRM4585U","level":2,"time":"2019-09-17T14:32:50+00:00","remoteAddr":"","user":"--","app":"user_ldap","method":"GET","url":"\/ocs\/v1.php\/cloud\/user?format=json","message":"Bind failed: 49: Invalid credentials","userAgent":"Mozilla\/5.0 (Android) Nextcloud-android\/3.8.0","version":""}
{"reqId":"jfDwBLetqFDdrRM4585U","level":2,"time":"2019-09-17T14:32:50+00:00","remoteAddr":"","user":"--","app":"core","method":"GET","url":"\/ocs\/v1.php\/cloud\/user?format=json","message":"Login failed: '<My Username>' (Remote IP: '')","userAgent":"Mozilla\/5.0 (Android) Nextcloud-android\/3.8.0","version":""}

I have also read these:

And look around some other github isues that mention getting a 401.

I am running php-fpm 7.2
Apache 2.4.37
HAProxy Loadbalancer
Nextcloud 16.0.1
I have tested current Stable and Beta branches of Nextcloud Android app. (It also happens in IOS App)
And as i said before, Nextcloud login works every time when I use a Browser, the App is what fails to log me in every time (and gives me the 401 and Login Loops)

I am having same problem,
first post here, please let me know if I do something wrong :slight_smile:
(opensuse tumbleweed, nextcloud 16.0.5, apache2-2.4.41 php-fpm 7.3.10)

Logins from the desktop client and android app both worked prior to switching from php7 to php7-fpm.
(switch was required to enable http2)

Nextcloud web interface shows the client as connected, the client shows as logged in, but the clients (tried on multiple machines) cannot sync. The android client briefly showed the same 401 error as noted above.
Android app offered “old method” login but that failed as well.

error follows
[PHP] Error: Undefined index: urlGenerator at /srv/http/nextcloud/core/templates/loginflowv2/done.php#29

POST /nextcloud/index.php/login/v2/grant
from by xxx at 2019-10-22T16:07:02+00:00

Did you have any luck resolving your issue?


Disabling php-fpm solved my problem.