This problem was caused by cookies. Edit: Adding a tag related to this problem for easier searching: AuthStateMissing
The development setup uses SESSION_COOKIE_SAMESITE = "Lax" while the production setup uses SESSION_COOKIE_SAMESITE = "None". Using None during testing fixed the missing state value problem.
However, now there is a new problem Authentication process canceled.