Android: No login possible.

Created on 3 Nov 2020  路  7Comments  路  Source: nextcloud/android

Steps to reproduce

No matter how you try to log in, all possibilities fail.
Normal password
App-Token
QR-Code

Expected behaviour

I would really appreciate it if the app did what it should.

Actual behaviour

The app shoots itself in the head. (crash after login attempt)

Can you reproduce this problem on https://try.nextcloud.com?

It says Server not found.

Environment data

Android version: 8.1.0

Device model: OnePlus 5

Stock or customized system: Custom AOKP

Nextcloud app version:
I tried the following: 3.14.0 RC1 ; 3.13.1 from F-Droid and gplay-release-30140051

Nextcloud server version: 20.0.1

Logs

Nextcloud log (data/nextcloud.log)

{"reqId":"XXXXXXXXXXX","level":3,"time":"2020-11-03T21:59:12+00:00","remoteAddr":"XXXXXX","user":"XXXXXXX","app":"PHP","method":"GET","url":"/index.php/settings/user","message":{"Exception":"Error","Message":"Undefined offset: 3 at /homepages/20/d757790702/htdocs/NextCloud/lib/private/legacy/OC_Helper.php#548","Code":0,"Trace":[{"file":"/homepages/20/XXXXXXX2/htdocs/NextCloud/lib/private/legacy/OC_Helper.php","line":548,"function":"onError","class":"OC\\Log\\ErrorHandler","type":"::","args":[8,"Undefined offset: 3","/homepages/20/XXXXXXXXX2/htdocs/NextCloud/lib/private/legacy/OC_Helper.php",548,{"path":"/","rootInfo":{"__class__":"OC\\Files\\FileInfo"},"includeExtStorage":false,"used":16608273,"quota":5368709120,"mount":{"__class__":"OC\\Files\\Mount\\MountPoint"},"storage":{"cache":null,"scanner":{"__class__":"OC\\Files\\Cache\\Scanner"},"watcher":null,"propagator":null,"updater":null,"__class__":"OCA\\Files_Trashbin\\Storage"},"sourceStorage":{"cache":null,"scanner":{"__class__":"OC\\Files\\Cache\\Scanner"},"watcher":null,"propagator":null,"updater":null,"__class__":"OCA\\Files_Trashbin\\Storage"},"free":5352100847,"total":5368709120,"relative":0.31,"ownerId":"XXXXXXXXX","ownerDisplayName":"XXXXXXXXX","owner":{"__class__":"OC\\User\\User"}}]},{"file":"/homepages/20/XXXXXXXXXXX2/htdocs/NextCloud/apps/settings/lib/Settings/Personal/PersonalInfo.php","line":108,"function":"getStorageInfo","class":"OC_Helper","type":"::","args":["/"]},{"file":"/homepages/20/XXXXXXXXXXXXXXX/htdocs/NextCloud/apps/settings/lib/Controller/CommonSettingsTrait.php","line":141,"function":"getForm","class":"OCA\\Settings\\Settings\\Personal\\PersonalInfo","type":"->","args":[]},{"file":"/homepages/20/XXXXXXX/htdocs/NextCloud/apps/settings/lib/Controller/PersonalSettingsController.php","line":77,"function":"formatSettings","class":"OCA\\Settings\\Controller\\PersonalSettingsController","type":"->","args":[{"10":[{"__class__":"OCA\\Settings\\Settings\\Personal\\PersonalInfo"}],"1000":[{"__class__":"OCA\\Settings\\Settings\\Personal\\ServerDevNotice"}]}]},{"file":"/homepages/20/XXXXXXXXX2/htdocs/NextCloud/apps/settings/lib/Controller/CommonSettingsTrait.php","line":152,"function":"getSettings","class":"OCA\\Settings\\Controller\\PersonalSettingsController","type":"->","args":["personal-info"]},{"file":"/homepages/20/XXXXXXXXXXX/htdocs/NextCloud/apps/settings/lib/Controller/PersonalSettingsController.php","line":68,"function":"getIndexResponse","class":"OCA\\Settings\\Controller\\PersonalSettingsController","type":"->","args":["personal","personal-info"]},{"file":"/homepages/20/XXXXXXXXXXXX2/htdocs/NextCloud/lib/private/AppFramework/Http/Dispatcher.php","line":169,"function":"index","class":"OCA\\Settings\\Controller\\PersonalSettingsController","type":"->","args":["personal-info"]},{"file":"/homepages/20/XXXXXXXXXX2/htdocs/NextCloud/lib/private/AppFramework/Http/Dispatcher.php","line":100,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\Settings\\Controller\\PersonalSettingsController"},"index"]},{"file":"/homepages/20/XXXXXXXXXX2/htdocs/NextCloud/lib/private/AppFramework/App.php","line":152,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\Settings\\Controller\\PersonalSettingsController"},"index"]},{"file":"/homepages/20/XXXXXXXXX/htdocs/NextCloud/lib/private/Route/Router.php","line":308,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Settings\\Controller\\PersonalSettingsController","index",{"__class__":"OC\\AppFramework\\DependencyInjection\\DIContainer"},{"section":"personal-info","action":null,"_route":"settings.PersonalSettings.index"}]},{"file":"/homepages/XXXXXXX2/htdocs/NextCloud/lib/base.php","line":1009,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/settings/user"]},{"file":"/homepages/20/XXXXXXXX2/htdocs/NextCloud/index.php","line":37,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/homepages/20/XXXXXXXXXX2/htdocs/NextCloud/lib/private/Log/ErrorHandler.php","Line":91,"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (X11; Linux x86_64; rv:56.0) Gecko/20100101 Firefox/56.0 Waterfox/56.3","version":"20.0.1.1"}
{"reqId":"XXXXXXXX","level":2,"time":"2020-11-03T22:08:59+00:00","remoteAddr":"XXXXXX","user":"--","app":"core","method":"GET","url":"/index.php/apps/calendar/","message":"Renewing session token failed","userAgent":"Mozilla/5.0 (Android 8.1.0; Mobile; rv:68.0) Gecko/68.0 Firefox/68.0","version":"20.0.1.1"}

Here is some more information:

************ CAUSE OF ERROR ************

java.lang.NullPointerException: Attempt to invoke virtual method 'void android.view.View.setVisibility(int)' on a null object reference
 at com.owncloud.android.authentication.AuthenticatorActivity.onAuthenticatorTaskCallback(AuthenticatorActivity.java:1186)
 at com.owncloud.android.authentication.AuthenticatorAsyncTask.onPostExecute(AuthenticatorAsyncTask.java:100)
 at com.owncloud.android.authentication.AuthenticatorAsyncTask.onPostExecute(AuthenticatorAsyncTask.java:43)
 at android.os.AsyncTask.finish(AsyncTask.java:695)
 at android.os.AsyncTask.-wrap1(Unknown Source:0)
 at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:712)
 at android.os.Handler.dispatchMessage(Handler.java:106)
 at android.os.Looper.loop(Looper.java:164)
 at android.app.ActivityThread.main(ActivityThread.java:6499)
 at java.lang.reflect.Method.invoke(Native Method)
 at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:440)
 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)

************ APP INFORMATION ************
ID: com.nextcloud.client
Version: 30140051
Build flavor: gplay

************ DEVICE INFORMATION ************
Brand: OnePlus
Device: OnePlus5
Model: ONEPLUS A5000
Product: OnePlus5

************ FIRMWARE ************
SDK: 27
Release: 8.1.0
bug needs infdiscussion

All 7 comments

pinging @tobiasKaminsky since this might be related to the RC1

@AndyScherzinger As already mentioned in my issue, I tested 3 versions!
-> 3.14.0 RC1
-> 3.13.1
Both from F-Droid.

And this version from your GitHub Release:
-> gplay-release-30140051

All with the same crash.

True, thanks for the hint, I kind of overread that 馃様

@tobiasKaminsky this seems kind of strange since:

// authorization fail due to client side - probably wrong credentials
            mLoginWebView = findViewById(R.id.login_webview);

            if (mLoginWebView != null) {
                ...
            } else {
                ...
                mLoginWebView.setVisibility(View.GONE);
                ...
            }

So strangely mLoginWebView is null in the else block...

@MrFlyingToasterman when exactly does it crash?

Can you provide us additional infos via logcat? https://github.com/nextcloud/android/blob/master/README.md#getting-debug-info-via-logcat

It looks like I've found the solution. I exchanged ideas with a few friends yesterday. It occurred to us to check the server-side .htaccess (Nextcloudpath). Interestingly, for some reason my htaccess looked like this:

#### DO NOT CHANGE ANYTHING ABOVE THIS LINE ####

ErrorDocument 403 //
ErrorDocument 404 //

I just unzipped NextCloud-20.0.1.zip and this was the default htacess. When I checked this content with a friend, we noticed that my config is virtually empty.

Then I tested the htaccess from my friend. It looked like this:

<IfModule mod_headers.c>
  <IfModule mod_setenvif.c>
    <IfModule mod_fcgid.c>
       SetEnvIfNoCase ^Authorization$ "(.+)" XAUTHORIZATION=$1
       RequestHeader set XAuthorization %{XAUTHORIZATION}e env=XAUTHORIZATION
    </IfModule>
    <IfModule mod_proxy_fcgi.c>
       SetEnvIfNoCase Authorization "(.+)" HTTP_AUTHORIZATION=$1
    </IfModule>
  </IfModule>

  <IfModule mod_env.c>
    # Add security and privacy related headers

    # Avoid doubled headers by unsetting headers in "onsuccess" table,
    # then add headers to "always" table: https://github.com/nextcloud/server/pull/19002
    Header onsuccess unset Referrer-Policy
    Header always set Referrer-Policy "no-referrer"

    Header onsuccess unset X-Content-Type-Options
    Header always set X-Content-Type-Options "nosniff"

    Header onsuccess unset X-Download-Options
    Header always set X-Download-Options "noopen"

    Header onsuccess unset X-Frame-Options
    Header always set X-Frame-Options "SAMEORIGIN"

    Header onsuccess unset X-Permitted-Cross-Domain-Policies
    Header always set X-Permitted-Cross-Domain-Policies "none"

    Header onsuccess unset X-Robots-Tag
    Header always set X-Robots-Tag "none"

    Header onsuccess unset X-XSS-Protection
    Header always set X-XSS-Protection "1; mode=block"

    SetEnv modHeadersAvailable true
  </IfModule>

  # Add cache control for static resources
  <FilesMatch "\.(css|js|svg|gif)$">
    Header set Cache-Control "max-age=15778463"
  </FilesMatch>

  # Let browsers cache WOFF files for a week
  <FilesMatch "\.woff2?$">
    Header set Cache-Control "max-age=604800"
  </FilesMatch>
</IfModule>
<IfModule mod_php7.c>
  php_value mbstring.func_overload 0
  php_value default_charset 'UTF-8'
  php_value output_buffering 0
  <IfModule mod_env.c>
    SetEnv htaccessWorking true
  </IfModule>
</IfModule>
<IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteCond %{HTTP_USER_AGENT} DavClnt
  RewriteRule ^$ /remote.php/webdav/ [L,R=302]
  RewriteRule .* - [env=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
  RewriteRule ^\.well-known/host-meta /public.php?service=host-meta [QSA,L]
  RewriteRule ^\.well-known/host-meta\.json /public.php?service=host-meta-json [QSA,L]
  RewriteRule ^\.well-known/webfinger /public.php?service=webfinger [QSA,L]
  RewriteRule ^\.well-known/nodeinfo /public.php?service=nodeinfo [QSA,L]
  RewriteRule ^\.well-known/carddav /remote.php/dav/ [R=301,L]
  RewriteRule ^\.well-known/caldav /remote.php/dav/ [R=301,L]
  RewriteRule ^remote/(.*) remote.php [QSA,L]
  RewriteRule ^(?:build|tests|config|lib|3rdparty|templates)/.* - [R=404,L]
  RewriteCond %{REQUEST_URI} !^/\.well-known/(acme-challenge|pki-validation)/.*
  RewriteRule ^(?:\.|autotest|occ|issue|indie|db_|console).* - [R=404,L]
</IfModule>
<IfModule mod_mime.c>
  AddType image/svg+xml svg svgz
  AddEncoding gzip svgz
</IfModule>
<IfModule mod_dir.c>
  DirectoryIndex index.php index.html
</IfModule>
AddDefaultCharset utf-8
Options -Indexes
<IfModule pagespeed_module>
  ModPagespeed Off
</IfModule>

#### DO NOT CHANGE ANYTHING ABOVE THIS LINE ####

RewriteEngine On
RewriteCond %{HTTP:Authorization} ^(.*)
RewriteRule .* - [e=HTTP_AUTHORIZATION:%1]

ErrorDocument 403 //
ErrorDocument 404 //

Now I can login without any problems.
My only question now is how this could happen.

I also looked at the htaccess from the unzipped zip archive again. I have one locally and one on the web server. The local version is unchanged from me. It looks like it's a completely different htaccess again. Here is its content:

<IfModule mod_headers.c>
  <IfModule mod_setenvif.c>
    <IfModule mod_fcgid.c>
       SetEnvIfNoCase ^Authorization$ "(.+)" XAUTHORIZATION=$1
       RequestHeader set XAuthorization %{XAUTHORIZATION}e env=XAUTHORIZATION
    </IfModule>
    <IfModule mod_proxy_fcgi.c>
       SetEnvIfNoCase Authorization "(.+)" HTTP_AUTHORIZATION=$1
    </IfModule>
  </IfModule>

  <IfModule mod_env.c>
    # Add security and privacy related headers

    # Avoid doubled headers by unsetting headers in "onsuccess" table,
    # then add headers to "always" table: https://github.com/nextcloud/server/pull/19002
    Header onsuccess unset Referrer-Policy
    Header always set Referrer-Policy "no-referrer"

    Header onsuccess unset X-Content-Type-Options
    Header always set X-Content-Type-Options "nosniff"

    Header onsuccess unset X-Download-Options
    Header always set X-Download-Options "noopen"

    Header onsuccess unset X-Frame-Options
    Header always set X-Frame-Options "SAMEORIGIN"

    Header onsuccess unset X-Permitted-Cross-Domain-Policies
    Header always set X-Permitted-Cross-Domain-Policies "none"

    Header onsuccess unset X-Robots-Tag
    Header always set X-Robots-Tag "none"

    Header onsuccess unset X-XSS-Protection
    Header always set X-XSS-Protection "1; mode=block"

    SetEnv modHeadersAvailable true
  </IfModule>

  # Add cache control for static resources
  <FilesMatch "\.(css|js|svg|gif)$">
    Header set Cache-Control "max-age=15778463"
  </FilesMatch>

  # Let browsers cache WOFF files for a week
  <FilesMatch "\.woff2?$">
    Header set Cache-Control "max-age=604800"
  </FilesMatch>
</IfModule>
<IfModule mod_php7.c>
  php_value mbstring.func_overload 0
  php_value default_charset 'UTF-8'
  php_value output_buffering 0
  <IfModule mod_env.c>
    SetEnv htaccessWorking true
  </IfModule>
</IfModule>
<IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteCond %{HTTP_USER_AGENT} DavClnt
  RewriteRule ^$ /remote.php/webdav/ [L,R=302]
  RewriteRule .* - [env=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
  RewriteRule ^\.well-known/host-meta /public.php?service=host-meta [QSA,L]
  RewriteRule ^\.well-known/host-meta\.json /public.php?service=host-meta-json [QSA,L]
  RewriteRule ^\.well-known/webfinger /public.php?service=webfinger [QSA,L]
  RewriteRule ^\.well-known/nodeinfo /public.php?service=nodeinfo [QSA,L]
  RewriteRule ^\.well-known/carddav /remote.php/dav/ [R=301,L]
  RewriteRule ^\.well-known/caldav /remote.php/dav/ [R=301,L]
  RewriteRule ^remote/(.*) remote.php [QSA,L]
  RewriteRule ^(?:build|tests|config|lib|3rdparty|templates)/.* - [R=404,L]
  RewriteCond %{REQUEST_URI} !^/\.well-known/(acme-challenge|pki-validation)/.*
  RewriteRule ^(?:\.|autotest|occ|issue|indie|db_|console).* - [R=404,L]
</IfModule>
<IfModule mod_mime.c>
  AddType image/svg+xml svg svgz
  AddEncoding gzip svgz
</IfModule>
<IfModule mod_dir.c>
  DirectoryIndex index.php index.html
</IfModule>
AddDefaultCharset utf-8
Options -Indexes
<IfModule pagespeed_module>
  ModPagespeed Off
</IfModule>

I hope I could contribute something useful. Thank you for your time!

Thanks for the heads-up @MrFlyingToasterman. ,Unfortunaltely we can't say why your htaccess config changes on your server while everywhere else you and your friend looked it has been correct :/ But happy that it is up and running normally :)

So closing this issue 馃憤

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rainer042 picture rainer042  路  3Comments

AndyScherzinger picture AndyScherzinger  路  3Comments

tobiasKaminsky picture tobiasKaminsky  路  3Comments

Tie-fighter picture Tie-fighter  路  3Comments

eppfel picture eppfel  路  3Comments