# Authentication timing out

**URL:** <https://help.nextcloud.com/t/authentication-timing-out/150408>\
**Category:** ℹ️ Support\
**Tags:** docker\
**Created:** [November 22, 2022, 10:31am UTC](https://help.nextcloud.com/t/authentication-timing-out/150408 "2022-11-22T10:31:05Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![sfphoton](https://help.nextcloud.com/letter_avatar/sfphoton/32/5_5575768a8748004e209b776fc1b2916d.png) [@sfphoton](https://help.nextcloud.com/u/sfphoton)\
**Post date:** [November 22, 2022, 10:31am UTC](https://help.nextcloud.com/t/authentication-timing-out/150408/1 "2022-11-22T10:31:05Z")

</div>

Nextcloud version: `25.0.1`  
Operating system and version: `Docker version 20.10.19 on Debian Bookworm`  
Apache or nginx version: `apache, the one present in the nextcloud:25-apache docker image`  
PHP version: `the one present in the nextcloud:25-apache docker image`

The issue you are facing:

Password-based authentication on `/index.php/login` takes extremely long time to authenticate any user, frequently causing a timeout in the browser, thus making the login fail.

This is not the issue of invalid credentials, because the server responds quickly about those, and a “Wrong username or password.” notification correctly appears. In case the credentials are correct, the server takes a very long time to respond. I have 3 users, out of which 2 are affected, 1 (happens to be the admin account) is not.

It is notable that the corresponding POST request, which carries the credentials, only shows up a few minutes afterwards. All the other requests are included in the log in time. I suspect this is because the php server does not reply for a long time, so the apache server waits for the status code to be included in the log entry.

Around the time of a timed out login attempt, nothing is printed either in the apache error log, `data/nextcloud.log` and the Administration \> Logging view. (This is a docker install, so where applicable, I checked the output of the `docker logs` command and the files themselves as well.)

Edit: I have also tried disabling all non-default apps, but I’m still facing this issue.

Is this the first time you’ve seen this error? : Y (based on user reports, this issue may have been consisting for several Nextcloud versions.)

Steps to replicate it:

I cannot replicate this issue reliably.

The output of your config.php file in `/path/to/nextcloud` (make sure you remove any identifiable information!):  
[Pastebin](https://pastebin.com/VS8MkLzG)

My `docker-compose.yml` file:  
[Pastebin](https://pastebin.com/WbAdA5wA)

---

<div class="post-metadata">

**Author:** ![KarlF12](https://help.nextcloud.com/user_avatar/help.nextcloud.com/karlf12/32/46873_2.png) [@KarlF12](https://help.nextcloud.com/u/KarlF12)\
**Post date:** [November 22, 2022, 6:12pm UTC](https://help.nextcloud.com/t/authentication-timing-out/150408/2 "2022-11-22T18:12:01Z")

</div>

Are you by chance using the built-in Collabora server? If so, try disabling that as well.

---

<div class="post-metadata">

**Author:** ![sfphoton](https://help.nextcloud.com/letter_avatar/sfphoton/32/5_5575768a8748004e209b776fc1b2916d.png) [@sfphoton](https://help.nextcloud.com/u/sfphoton)\
**Post date:** [November 23, 2022, 9:00am UTC](https://help.nextcloud.com/t/authentication-timing-out/150408/3 "2022-11-23T09:00:23Z")

</div>

Thanks, but I do not use the Collabora server.

---

<div class="post-metadata">

**Author:** ![sfphoton](https://help.nextcloud.com/letter_avatar/sfphoton/32/5_5575768a8748004e209b776fc1b2916d.png) [@sfphoton](https://help.nextcloud.com/u/sfphoton)\
**Post date:** [November 29, 2022, 1:02pm UTC](https://help.nextcloud.com/t/authentication-timing-out/150408/4 "2022-11-29T13:02:18Z")

</div>

I have tried switching to FPM from the apache-based solution, and the issue still persists.

---

<div class="post-metadata">

**Author:** ![sfphoton](https://help.nextcloud.com/letter_avatar/sfphoton/32/5_5575768a8748004e209b776fc1b2916d.png) [@sfphoton](https://help.nextcloud.com/u/sfphoton)\
**Post date:** [November 29, 2022, 10:40pm UTC](https://help.nextcloud.com/t/authentication-timing-out/150408/5 "2022-11-29T22:40:01Z")

</div>

Digging through the database, it turned out that affected accounts had thousands of auth tokens in the `oc_authtoken` table. Based on an old [reply on another thread](https://help.nextcloud.com/t/very-slow-login-after-updating-to-21-0-3/113693/64), having many of these slows down the login process vastly.

I have deleted tokens of these users, and authentication is fast again.

---

<div class="post-metadata">

**Author:** ![wwe](https://help.nextcloud.com/user_avatar/help.nextcloud.com/wwe/32/72963_2.png) [@wwe](https://help.nextcloud.com/u/wwe)\
**Post date:** [December 14, 2024, 11:34am UTC](https://help.nextcloud.com/t/authentication-timing-out/150408/6 "2024-12-14T11:34:24Z")

</div>


