After fresh installation cannot login

Nextcloud version (eg, 12.0.2): 15.0.7.0
Operating system and version (eg, Ubuntu 17.04): Turris 4.0
Apache or nginx version (eg, Apache 2.4.25): lighttpd/1.4.50 (ssl) - a light and fast webserver
PHP version (eg, 7.1): PHP 7.2.16 (fpm-fcgi)

The issue you are facing: After fresh installation of Nextcloud 15.0.7 I am not able to login with account I created during installation.

Is this the first time you’ve seen this error? (Y/N): Y

Steps to replicate it:

  1. Attempt to log in to system from web browser using specified account
  2. Receive “Internal Server Error” message on web-based login screen

The output of your Nextcloud log in Admin > Logging:

{"reqId":"T7RUw2dNNTXJ9qQPRXwG","level":3,"time":"2019-05-19T22:33:24+00:00","remoteAddr":"192.168.1.116","user":"ivanek","app":"index","method":"POST","url":
"\/nextcloud\/index.php\/login?user=ivanek","message":{"Exception":"TypeError","Message":"base64_encode() expects parameter 1 to be string, null given","Code"
:0,"Trace":[{"file":"\/srv\/www\/nextcloud\/lib\/private\/Authentication\/Token\/PublicKeyTokenProvider.php","line":242,"function":"base64_encode","args":["**
* sensitive parameter replaced ***"]},{"file":"\/srv\/www\/nextcloud\/lib\/private\/Authentication\/Token\/PublicKeyTokenProvider.php","line":309,"function":"
encryptPassword","class":"OC\\Authentication\\Token\\PublicKeyTokenProvider","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"\/srv\/www
\/nextcloud\/lib\/private\/Authentication\/Token\/PublicKeyTokenProvider.php","line":70,"function":"newToken","class":"OC\\Authentication\\Token\\PublicKeyTok
enProvider","type":"->","args":["*** sensitive parameter replaced ***","*** sensitive parameter replaced ***","*** sensitive parameter replaced ***","*** sens
itive parameter replaced ***","*** sensitive parameter replaced ***","*** sensitive parameter replaced ***","*** sensitive parameter replaced ***"]},{"file":"
\/srv\/www\/nextcloud\/lib\/private\/Authentication\/Token\/Manager.php","line":69,"function":"generateToken","class":"OC\\Authentication\\Token\\PublicKeyTok
enProvider","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"\/srv\/www\/nextcloud\/lib\/private\/User\/Session.php","line":641,"functio
n":"generateToken","class":"OC\\Authentication\\Token\\Manager","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"\/srv\/www\/nextcloud\/
core\/Controller\/LoginController.php","line":340,"function":"createSessionToken","class":"OC\\User\\Session","type":"->","args":["*** sensitive parameters re
placed ***"]},{"file":"\/srv\/www\/nextcloud\/lib\/private\/AppFramework\/Http\/Dispatcher.php","line":166,"function":"tryLogin","class":"OC\\Core\\Controller
\\LoginController","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"\/srv\/www\/nextcloud\/lib\/private\/AppFramework\/Http\/Dispatcher.
php","line":99,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OC\\Core\\Controller\\LoginContro
ller"},"tryLogin"]},{"file":"\/srv\/www\/nextcloud\/lib\/private\/AppFramework\/App.php","line":118,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dis
patcher","type":"->","args":[{"__class__":"OC\\Core\\Controller\\LoginController"},"tryLogin"]},{"file":"\/srv\/www\/nextcloud\/lib\/private\/AppFramework\/Ro
uting\/RouteActionHandler.php","line":47,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OC\\Core\\Controller\\LoginController","tryLog
in",{"__class__":"OC\\AppFramework\\DependencyInjection\\DIContainer"},{"_route":"core.login.tryLogin"}]},{"function":"__invoke","class":"OC\\AppFramework\\Ro
uting\\RouteActionHandler","type":"->","args":[{"_route":"core.login.tryLogin"}]},{"file":"\/srv\/www\/nextcloud\/lib\/private\/Route\/Router.php","line":297,
"function":"call_user_func","args":[{"__class__":"OC\\AppFramework\\Routing\\RouteActionHandler"},{"_route":"core.login.tryLogin"}]},{"file":"\/srv\/www\/next
cloud\/lib\/base.php","line":987,"function":"match","class":"OC\\Route\\Router","type":"->","args":["\/login"]},{"file":"\/srv\/www\/nextcloud\/index.php","li
ne":42,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"\/srv\/www\/nextcloud\/lib\/private\/Authentication\/Token\/PublicKeyTokenProvi
der.php","Line":242,"CustomMessage":"--"},"userAgent":"Mozilla\/5.0 (Macintosh; Intel Mac OS X 10.14; rv:66.0) Gecko\/20100101 Firefox\/66.0","version":"15.0.
7.0"}

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php
$CONFIG = array (
  'passwordsalt' => '[redacted]',
  'secret' => '[redacted]',
  'trusted_domains' =>
  array (
    0 => 'localhost',
    1 => '192.168.1.1',
    2 => '[redacted]',
  ),
  'datadirectory' => '/srv/www/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '15.0.7.0',
  'overwrite.cli.url' => 'http://localhost',
  'dbname' => 'nextcloud',
  'dbhost' => '127.0.0.1',
  'dbport' => '3306',
  'dbtableprefix' => 'oc_',
  'dbuser' => '[redacted]',
  'dbpassword' => '[redacted]',
  'installed' => true,
  'instanceid' => '[redacted]',
  'updatechecker' => 'false',
);

The output of your Apache/nginx/system log in /var/log/____: Not applicable.

Similar question: Unable to Login With Initial Account

However I cannot resolve it with password reset. Even after resetting the password, issue still persists.

Hi. which way of installation you chose? Also, have you tried reinstalling it?

HI, I installed Nextcloud following Turris instructions: https://doc.turris.cz/doc/en/howto/nextcloud

echo 'Install("nextcloud-install")' >> /etc/updater/conf.d/auto.lua
pkgupdate
nextcloud_install

I also tried to reinstall it but it did not help.

what are the credentials you tried? i dont know anything about turris but this guy had the same problem: thttps://forum.turris.cz/t/nextcloud-nextcloud-install-bugs-issues/5629 thisbg

look at his last point? can you establish a connection with the db?

I tried the credentials I set during installation, account “ivanek” and the matching password. After login attempt, the nextcloud does not complain about wrong password.

I believe that the connection to db works fine. If I type ‘wrong’ password, I immediately get an error message wrong password . However with the correct password I only get the error message mentioned above:

Internal Server Error

The server was unable to complete your request.
If this happens again, please send the technical details below to the server administrator.
More details can be found in the server log.

and what the logs are saying?

I posted it already above in my first post.

{"reqId":"z5tohacAOwCgKxxS8qGv","level":3,"time":"2019-05-24T11:04:05+00:00","remoteAddr":"10.111.111.6","user":"ivanek","app":"index","method":"POST","url":"\/nextcloud\/index.php\/login","message":{"Exception":"TypeError","Message":"base64_encode() expects parameter 1 to be string, null given","Code":0,"Trace":[{"file":"\/srv\/www\/nextcloud\/lib\/private\/Authentication\/Token\/PublicKeyTokenProvider.php","line":242,"function":"base64_encode","args":["*** sensitive parameter replaced ***"]},{"file":"\/srv\/www\/nextcloud\/lib\/private\/Authentication\/Token\/PublicKeyTokenProvider.php","line":308,"function":"encryptPassword","class":"OC\\Authentication\\Token\\PublicKeyTokenProvider","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"\/srv\/www\/nextcloud\/lib\/private\/Authentication\/Token\/PublicKeyTokenProvider.php","line":70,"function":"newToken","class":"OC\\Authentication\\Token\\PublicKeyTokenProvider","type":"->","args":["*** sensitive parameter replaced ***","*** sensitive parameter replaced ***","*** sensitive parameter replaced ***","*** sensitive parameter replaced ***","*** sensitive parameter replaced ***","*** sensitive parameter replaced ***","*** sensitive parameter replaced ***"]},{"file":"\/srv\/www\/nextcloud\/lib\/private\/Authentication\/Token\/Manager.php","line":69,"function":"generateToken","class":"OC\\Authentication\\Token\\PublicKeyTokenProvider","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"\/srv\/www\/nextcloud\/lib\/private\/User\/Session.php","line":641,"function":"generateToken","class":"OC\\Authentication\\Token\\Manager","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"\/srv\/www\/nextcloud\/core\/Controller\/LoginController.php","line":340,"function":"createSessionToken","class":"OC\\User\\Session","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"\/srv\/www\/nextcloud\/lib\/private\/AppFramework\/Http\/Dispatcher.php","line":166,"function":"tryLogin","class":"OC\\Core\\Controller\\LoginController","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"\/srv\/www\/nextcloud\/lib\/private\/AppFramework\/Http\/Dispatcher.php","line":99,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OC\\Core\\Controller\\LoginController"},"tryLogin"]},{"file":"\/srv\/www\/nextcloud\/lib\/private\/AppFramework\/App.php","line":118,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OC\\Core\\Controller\\LoginController"},"tryLogin"]},{"file":"\/srv\/www\/nextcloud\/lib\/private\/AppFramework\/Routing\/RouteActionHandler.php","line":47,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OC\\Core\\Controller\\LoginController","tryLogin",{"__class__":"OC\\AppFramework\\DependencyInjection\\DIContainer"},{"_route":"core.login.tryLogin"}]},{"function":"__invoke","class":"OC\\AppFramework\\Routing\\RouteActionHandler","type":"->","args":[{"_route":"core.login.tryLogin"}]},{"file":"\/srv\/www\/nextcloud\/lib\/private\/Route\/Router.php","line":297,"function":"call_user_func","args":[{"__class__":"OC\\AppFramework\\Routing\\RouteActionHandler"},{"_route":"core.login.tryLogin"}]},{"file":"\/srv\/www\/nextcloud\/lib\/base.php","line":987,"function":"match","class":"OC\\Route\\Router","type":"->","args":["\/login"]},{"file":"\/srv\/www\/nextcloud\/index.php","line":42,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"\/srv\/www\/nextcloud\/lib\/private\/Authentication\/Token\/PublicKeyTokenProvider.php","Line":242,"CustomMessage":"--"},"userAgent":"Mozilla\/5.0 (Macintosh; Intel Mac OS X 10.14; rv:66.0) Gecko\/20100101 Firefox\/66.0","version":"15.0.7.0"}

I have this exact same problem , did you ever get an answer?

Unfortunately not yet.

Got a similar problem with my cloud. When updating from 15.0.7 to 16.0.1, it stopped login me on web side. My solution was changing, on the php config (etc/php7/apache/php.ini), the configuration for the maximum POST size

`max_post_size = 10G`

to

`max_post_size = 10737418240`

And then restart the apache web server

Also it worked with the max_post_size = 0, that means no limit. But it seems dangerous to me.

1 Like

What was the exact error in your case?

I believe that in my case, the error is caused by issue with openssl and /dev/crypto. If I remove the OPENSSL_PKCS1_OAEP_PADDING from openssl_public_encrypt and openssl_private_decrypt function calls in lib/private/Authentication/Token/PublicKeyTokenProvider.php I can log in.

However this is just a dirty hack and not solution to the problem.

Mine was similar, as I was not able to log via web to my cloud.

{"reqId":"J43WZxopmIkYoieW4GvP","level":3,"time":"2019-06-06T10:25:22+00:00","remoteAddr":"192.168.1.10","user":"--","app":"PHP","method":"POST","url":"\/index.php\/login","message":"Unknown: POST Content-Length of 197 bytes exceeds the limit of 10 bytes at Unknown#0","userAgent":"Mozilla\/5.0 (X11; Linux x86_64; rv:67.0) Gecko\/20100101 Firefox\/67.0","version":"16.0.1.1"}

The matter was the length of the POST, as php was interpreting that only 10 bytes where allowed
The original limit was 10 Giga, put as 10G
The G was never interpreted as Giga :upside_down_face:

But this a completely different error.

I see, but the symptoms were similar at first.
Hope someone finds a clue.
If you have more data about the problem, don’t hesitate to post it, as it will help others too.
Good luck! :four_leaf_clover:

Super! That was the problem in my cache! i changet it to max_post_size = 16M and worked!
@ivanek Thanks!