Can't login after restore

I have migrated a Nextcloud instance (v20) to a new server (Docker latest).
After restoring the DB, the data dir and the config file, occ status shows:

occ status
  - installed: true
  - version: 25.0.2.3
  - versionstring: 25.0.2
  - edition: 
  - maintenance: false
  - needsDbUpgrade: false
  - productname: Nextcloud
  - extendedSupport: false

I can navigate to the login page.
But when trying to login with my user, I get this in the log:

U79AxbgU7yA7tA3HYw","level":1,"time":"2023-01-02T12:48:23+00:00","remoteAddr":"213.47.51.196","user":"--","app":"core","method":"POST","url":"/login","message":"Tried to log in didi but could not verify token","userAgent":"Mozilla/5.0 (Windows NT 10.0; rv:108.0) Gecko/20100101 Firefox/108.0","version":"25.0.2.3","data":{"app":"core"}}
{"reqId":"MpSg4d6FXKrA3KaZhFYA","level":1,"time":"2023-01-02T12:48:23+00:00","remoteAddr":"213.47.51.196","user":"--","app":"core","method":"GET","url":"/apps/dashboard/","message":"Tried to log in didi but could not verify token","userAgent":"Mozilla/5.0 (Windows NT 10.0; rv:108.0) Gecko/20100101 Firefox/108.0","version":"25.0.2.3","data":{"app":"core"}}
{"reqId":"MpSg4d6FXKrA3KaZhFYA","level":0,"time":"2023-01-02T12:48:23+00:00","remoteAddr":"213.47.51.196","user":"--","app":"no app in context","method":"GET","url":"/apps/dashboard/","message":"Current user is not logged in","userAgent":"Mozilla/5.0 (Windows NT 10.0; rv:108.0) Gecko/20100101 Firefox/108.0","version":"25.0.2.3","exception":{"Exception":"OC\\AppFramework\\Middleware\\Security\\Exceptions\\NotLoggedInException","Message":"Current user is not logged in","Code":401,"Trace":[{"file":"/var/www/html/lib/private/AppFramework/Middleware/MiddlewareDispatcher.php","line":97,"function":"beforeController","class":"OC\\AppFramework\\Middleware\\Security\\SecurityMiddleware","type":"->","args":[{"__class__":"OCA\\Dashboard\\Controller\\DashboardController"},"index"]},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":125,"function":"beforeController","class":"OC\\AppFramework\\Middleware\\MiddlewareDispatcher","type":"->","args":[{"__class__":"OCA\\Dashboard\\Controller\\DashboardController"},"index"]},{"file":"/var/www/html/lib/private/AppFramework/App.php","line":172,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\Dashboard\\Controller\\DashboardController"},"index"]},{"file":"/var/www/html/lib/private/Route/Router.php","line":298,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Dashboard\\Controller\\DashboardController","index",{"__class__":"OC\\AppFramework\\DependencyInjection\\DIContainer"},["dashboard.dashboard.index"]]},{"file":"/var/www/html/lib/base.php","line":1047,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/apps/dashboard/"]},{"file":"/var/www/html/index.php","line":36,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/var/www/html/lib/private/AppFramework/Middleware/Security/SecurityMiddleware.php","Line":153,"message":"Current user is not logged in","exception":{},"CustomMessage":"Current user is not logged in"}}

I triple checked instanceid, passwordsalt and secret in the config file, they’re the same.
I also tried to reset the password with occ user:resetpassword, but that didn’t fix it.
The only idea I have about what could be related: the previous install was set up to use Redis, which the new one is not. But in case that’s the reason: what can I do about it?

What also changed is the DB user - was “nextcloud” before, is now “root”. But I don’t think that’s relevant, is it?

Assuming I’m ok with resetting all passwords in order to get it working, how can I achieve this?

The issue disappeared after adding a reverse proxy and using that in the browser.

Hi @d10r ,

Can you elaborate on the reverse-proxy aspect? I am facing same error (“Current user is not logged in”) and would appreciate the context of your fix.

Thanks,
Pawel

Since the instance I was restoring had been running through a reverse proxy before, I just re-applied that setup by setting up an nginx reverse proxy (was Apache based before) and also restoring that setting in config.php (add the domain in the array 'trusted_domains).
I don’t have an explanation why that would solve the problem, but since it did, I don’t bother to further investigate.