State token problems

The Basics

  • Nextcloud Server version (e.g., 29.x.x):
    • 31.0.4
  • Operating system and version (e.g., Ubuntu 24.04):
    • Debian 12 with Docker Compose
  • Reverse proxy and version _(e.g. nginx 1.27.2)
    • Nginx Proxy Manager - Version 2.12.3
  • Is this the first time you’ve seen this error? (Yes / No):
    • No
  • When did this problem seem to first start?
    • When enabling default encryption module
  • Installation method (e.g. AlO, NCP, Bare Metal/Archive, etc.)
    • Nextcloud AIO
  • Are you using CloudfIare, mod_security, or similar? (Yes / No)
    • No

Summary of the issue you are facing:

Hey,

I’m new here.

So my problem is that when I enable the default encryption module and want to connect a new or existing account to an nextcloud app i have state token erros. Also the apps every time tells me that the encryption keys are note initalized and I should log out and log in again.
I have already reinstalled my whole instance but nothing helps.

I cheked the config and the overwriteprotocol and the other settings are set like they should set.

Steps to replicate it (hint: details matter!):

  1. Install defalut encyption module
  2. Enable server side encryption
  3. Try to log in with an existing or new NC user to an Nextcloud App (not web-app)

Log entries

Nextcloud.log file

Error core OC\Authentication\Exceptions\InvalidTokenException: Token does not exist: token does not exist at 2025-04-27T13:29:38+00:00 .../Authentication/Token/PublicKeyTokenProvider.php line 165 0. .../Token/PublicKeyTokenProvider.php line 232 OC\Authentication\Token\PublicKeyTokenProvider->getToken("*** sensitive parameters replaced ***") 1. .../TTransactional.php line 45 OC\Authentication\Token\PublicKeyTokenProvider->OC\Authentication\Token\{closure}("*** sensitive paramet ... *") 2. .../Token/PublicKeyTokenProvider.php line 231 OC\Authentication\Token\PublicKeyTokenProvider->atomic(Closure {}, OC\DB\ConnectionAdapter {}) 3. .../Authentication/Token/Manager.php line 155 OC\Authentication\Token\PublicKeyTokenProvider->renewSessionToken( "*** sensitive parameters replaced ***", "0622c622f21dd750ef98deb0481ff2d1" ) 4. lib/private/User/Session.php line 883 OC\Authentication\Token\Manager->renewSessionToken( "*** sensitive parameters replaced ***", "0622c622f21dd750ef98deb0481ff2d1" ) 5. lib/base.php line 1107 OC\User\Session->loginWithCookie("*** sensitive parameters replaced ***") 6. lib/base.php line 1014 OC::handleLogin(OC\AppFramework\Http\Request {}) 7. index.php line 24 OC::handleRequest( ) Caused by OCP\AppFramework\Db\DoesNotExistException: token does not exist at .../Authentication/Token/PublicKeyTokenMapper.php line 81 0. .../Token/PublicKeyTokenProvider.php line 157 OC\Authentication\Token\PublicKeyTokenMapper->getToken("*** sensitive parameters replaced ***") 1. .../Token/PublicKeyTokenProvider.php line 232 OC\Authentication\Token\PublicKeyTokenProvider->getToken("*** sensitive parameters replaced ***") 2. .../TTransactional.php line 45 OC\Authentication\Token\PublicKeyTokenProvider->OC\Authentication\Token\{closure}("*** sensitive paramet ... *") 3. .../Token/PublicKeyTokenProvider.php line 231 OC\Authentication\Token\PublicKeyTokenProvider->atomic(Closure {}, OC\DB\ConnectionAdapter {}) 4. .../Authentication/Token/Manager.php line 155 OC\Authentication\Token\PublicKeyTokenProvider->renewSessionToken( "*** sensitive parameters replaced ***", "0622c622f21dd750ef98deb0481ff2d1" ) 5. lib/private/User/Session.php line 883 OC\Authentication\Token\Manager->renewSessionToken( "*** sensitive parameters replaced ***", "0622c622f21dd750ef98deb0481ff2d1" ) 6. lib/base.php line 1107 OC\User\Session->loginWithCookie("*** sensitive parameters replaced ***") 7. lib/base.php line 1014 OC::handleLogin(OC\AppFramework\Http\Request {}) 8. index.php line 24 OC::handleRequest( )

Before troubleshooting much further, can you confirm you have Asset Caching off in in NPM?

Yes, it is off