nextcloud / ios

📱 Nextcloud iOS App
https://itunes.apple.com/us/app/nextcloud/id1125420102
GNU General Public License v3.0
1.95k stars 877 forks source link

Error 401 in iOS App #1147

Closed Dennis1993 closed 4 years ago

Dennis1993 commented 4 years ago

Expected behaviour

No error message

Actual behaviour

after I starting the App the error 401 is shown. In server log the message "bad login for "274782-23134234-45345435345-123213" " (ldap user) is shown

Steps to reproduce

start the App and login with the ldap account

Reasoning or why should it be changed/implemented?

iOS version

13.3.1

App version

2.25.69

Server configuration

Operating system: Ubuntu 16.04

Web server: Apache 2.4

Database: MySQL 5.7

PHP version: 7.3.14

Nextcloud version: (see Nextcloud admin page) 17.0.3

I read the installation guide again and checked all PHP modules, All ok. Maybe a problem with the App? The error message appiers 1 or 2 seconds and then the files are displayed and I can use it...

IMG_6878

marinofaggiana commented 4 years ago

After the update the red box is gone. Now the next error message appears 😂

9D644F35-517A-48AE-9003-ACDF868B29ED

If you want, open another issue , please follow only this thread.

JoeKun commented 4 years ago

@marinofaggiana I just opened a new issue to track the 404 error. See https://github.com/nextcloud/ios/issues/1159

unnilennium commented 4 years ago

Hi, before the update I had both 401 error and 404.

the 401 part seems solved (https://github.com/nextcloud/ios/issues/1153), but not the 404 error as it is still occurring even with the update. I have taken some time to debug this. It has been a while the ios app is giving some difficulties for users from ldap db using a uuid as identifier. First ability to mark as favorite or remove, then ability to edit existing text files, and recently errors when trying to to anything from navigating to opening a file. (https://github.com/nextcloud/ios/issues/223) If you check in the nextcloud apps this is logged as failure to login, while the app is well logged in and able to navigating ( while throwing 401 and 404 errors mentioned above).

if you take care at the apache access_log you then understand what is happening

let's say you have user mylogin which has been linked from ldap db with a uuid 5279b38a-b8ed-1031-9373-cf418e4c8c3b (default behaviour of nextcloud)

if you try to access a file from the web interface you will hit at a moment the search for your avatar : GET /nextcloud/index.php/avatar/5279b38a-b8ed-1031-9373-cf418e4c8c3b/128

but the app does

GET /nextcloud/index.php/avatar/mylogin/128 and hits a 404

"GET /nextcloud/index.php/avatar/mylogin/128 HTTP/1.1" 404 - "-" "Mozilla/5.0 (iOS) Nextcloud-iOS/2.25.8" "REPORT /nextcloud/remote.php/dav/files/mylogin HTTP/1.1" 404 225 "-" "Mozilla/5.0 (iOS) Nextcloud-iOS/2.25.8"

As I said for the 401 part seems fixed for now "PROPFIND /nextcloud/remote.php/webdav HTTP/1.1" 401 343 "-" "Mozilla/5.0 (iOS) Nextcloud-iOS/2.25.6" "PROPFIND /nextcloud/remote.php/webdav HTTP/1.1" 207 1183 "-" "Mozilla/5.0 (iOS) Nextcloud-iOS/2.25.8" normal, either mylogin does not exist or is not the same user for nextcloud. further more as default behaviour uuid is not supposed to be used as a login name, only the username and email from the ldap dp are accepted.

So the real fix would be to get the ios app translate the login used to the nextcloud uuid and start creating again all the URL with it instead of the login used.

a workaround is something proposed on some forum post, ie modify the default behaviour of ldap nextcloud implementation and risking collision between usernames from different db.

references: https://bugs.contribs.org/show_bug.cgi?id=10876 https://help.nextcloud.com/t/ios-2-17-nc-11-0-3-error-404-with-ldap-users-and-favorites-folder-solved/11772/5 https://github.com/nextcloud/ios/issues/223#issuecomment-299940245

and yes I can say that both this issue and 223 are related and are fixed the same way :+1: I tested migrating all my ldap users on one instance of nextcloud I control and not on the others, guess what, the one where I changed the ldap integration (which again is not suitable to do ) has stop throwing errors as reported here, and also fixed the #223 issue before updating the ios app.

everything used to work in the past, so something must have changed either in the ios app or in the server code to not translate login name to correct user uuid, and it would be good to reverse this.

marinofaggiana commented 4 years ago

use https://github.com/nextcloud/ios/issues/1159 for 404

YongmaoLuo commented 4 years ago

Hi! @marinofaggiana However in version 2.25.9, 401 occurs frequently. After I switch to other app for several minutes, I got 401 error and the nextcloud app popup a window to ask me to log in again. And when I check the log file created by caddy, it shows that "SEARCH /remote.php/dav HTTP/2.0 401 343". However in a short time zone just after I enter my nextcloud password on my iPhone( maybe several minutes), log shows that "SEARCH /remote.php/dav HTTP/2.0 207 6062".

iOS - 13.4 iPhone X App-Version 2.25.9

Server - Debian 9 Caddy 2.4.29 PHP-FPM 7.3 Nextcloud 17.0.5

image

you may notice from the image that every time I open the nextcloud, it asked me to log in, and create a new device login record. Thanks!

Zignet64 commented 4 years ago

Can't open the ios pps got 401 error on first authentication !

iOS version 13.4.1 App version 2.25.69

Server : Docker Version 19.03.8 PHP_VERSION 7.3.17 MARIADB_VERSION 1:10.4.12+maria~bionic NEXTCLOUD_VERSION 18.0.4

So why close the issue ?

Attachment0

marinofaggiana commented 4 years ago

Try with the version 3 in TestFlight

Zignet64 commented 4 years ago

Try with the version 3 in TestFlight

No improvement with v3 still get 401 error

info : no LDAP, only 2 local user, fresh install to test Nextcloud

Works fine on desktop with any web client Chrome/Firefox and with web client safari/chrome on phone.

V3: Attachment0 (1)

Chrome iOS Attachment0 (2)

meichthys commented 2 years ago

It seems as though any iOS connections to Nextcloud (via the nextcloud app or via iOS Reminders/Calendar) try to connect without BasicAuth and fail with a 401 status code and then subsequently it tries again with BasicAuth and succeeds with a 201 status:

Screen Shot 2022-04-19 at 1 23 34 AM