Cannot login due to invalid or expired token

I cannot login to my server, whenever I try to connect the client redirects to an url that it says:

Acceso denegado

Your login token is invalid or has expired

I’ve got errors like these ones:

[OCC::CheckServerJob::finished  No SSL session identifier / session ticket is used, this might impact sync performance negatively.
[OCC::CheckServerJob::finished  status.php returns:  QJsonDocument({"edition":"","installed":true,"maintenance":false,"needsDbUpgrade":false,"productname":"Nube de Silicon-aid","version":"16.0.1.1","versionstring":"16.0.1"})   QNetworkReply::NoError  Reply:  QNetworkReplyHttpImpl(0x5573fde71080)
[OCC::DetermineAuthTypeJob::start       Determining auth type for QUrl("https://cloud.example.com/remote.php/webdav/")
--
[OCC::AbstractNetworkJob::start         OCC::SimpleNetworkJob created for "https://cloud.example.com" + "" "OCC::Account"
[OCC::AbstractNetworkJob::slotFinished  QNetworkReply::ContentNotFoundError "Server replied \"404 Not Found\" to \"POST https://cloud.example.com/login/v2/poll\"" QVariant(int, 404)
[OCC::AccessManager::createRequest      4 "" "https://cloud.example.com/login/v2/poll" has X-Request-ID "ccee8b07-5b59-41bf-b48c-313055fddafe"
[OCC::AbstractNetworkJob::start         OCC::SimpleNetworkJob created for "https://cloud.example.com" + "" "OCC::Account"
[OCC::AbstractNetworkJob::slotFinished  QNetworkReply::ContentNotFoundError "Server replied \"404 Not Found\" to \"POST https://cloud.example.com/login/v2/poll\"" QVariant(int, 404)
[OCC::AccessManager::createRequest      4 "" "https://cloud.example.com/login/v2/poll" has X-Request-ID "572dfb85-7238-460b-9611-66266a9eaaff"
[OCC::AbstractNetworkJob::start         OCC::SimpleNetworkJob created for "https://cloud.example.com" + "" "OCC::Account"
[OCC::AbstractNetworkJob::slotFinished  QNetworkReply::ContentNotFoundError "Server replied \"404 Not Found\" to \"POST https://cloud.example.com/login/v2/poll\"" QVariant(int, 404)
[OCC::AccessManager::createRequest      4 "" "https://cloud.example.com/login/v2/poll" has X-Request-ID "aec7725e-c1a7-4071-97ee-db4ec8e88d2c"
[OCC::AbstractNetworkJob::start         OCC::SimpleNetworkJob created for "https://cloud.example.com" + "" "OCC::Account"
[OCC::AbstractNetworkJob::slotFinished  QNetworkReply::ContentNotFoundError "Server replied \"404 Not Found\" to \"POST https://cloud.example.com/login/v2/poll\"" QVariant(int, 404)
[OCC::SocketApi::slotNewConnection      New connection QLocalSocket(0x5573fdf054b0)
--
[OCC::AbstractNetworkJob::start         OCC::SimpleNetworkJob created for "https://cloud.example.com" + "" "OCC::Account"
[OCC::AbstractNetworkJob::slotFinished  QNetworkReply::ContentNotFoundError "Server replied \"404 Not Found\" to \"POST https://cloud.example.com/login/v2/poll\"" QVariant(int, 404)
[OCC::AccessManager::createRequest      4 "" "https://cloud.example.com/login/v2/poll" has X-Request-ID "3423c014-29e2-41e0-a5ab-311f9b6d8fea"
[OCC::AbstractNetworkJob::start         OCC::SimpleNetworkJob created for "https://cloud.example.com" + "" "OCC::Account"
[OCC::AbstractNetworkJob::slotFinished  QNetworkReply::ContentNotFoundError "Server replied \"404 Not Found\" to \"POST https://cloud.example.com/login/v2/poll\"" QVariant(int, 404)

Any ideas?

Thanks in advance!

I’ve applied this workaround https://github.com/nextcloud/desktop/issues/1412#issuecomment-540458549 and it works.

I had the same issue. Workaround from sebelks link couldn’t be applied for me as I’m using Windows. I’m windows system administrator, so it was hard for me to read all this logs and I asked my friend to help me. To solve this problem you should just update SAMLController.php and UserBackend.php.
links: