401 Unauthorized after app installation - Sessions not being created in production (React Router v7)

Thank you a lot for the response!

After creating this post, I was shown a related post that I hadn’t found before. In that post, the user mentioned enabling the ShopifyApp logger in shopify.server.ts, which revealed a "nbf" claim timestamp check failed error — exactly the same issue I encountered.

It turned out my server time was about one minute behind. After configuring the firewall to allow outgoing UDP traffic on port 123 (used by NTP) and some ssh/cli magic, the issue was resolved.

xxx:~# timedatectl status
               Local time: Wed 2025-12-17 18:46:43 UTC
           Universal time: Wed 2025-12-17 18:46:43 UTC
                 RTC time: Wed 2025-12-17 18:47:40
                Time zone: Etc/UTC (UTC, +0000)
System clock synchronized: no
              NTP service: active
          RTC in local TZ: no
xxx:~# sudo systemctl enable systemd-timesyncd
xxx:~# sudo systemctl start systemd-timesyncd
xxx:~# sudo timedatectl set-ntp true
xxx:~# sudo systemctl restart systemd-timesyncd
xxx:~# timedatectl status
               Local time: Wed 2025-12-17 18:56:43 UTC
           Universal time: Wed 2025-12-17 18:56:43 UTC
                 RTC time: Wed 2025-12-17 18:56:43
                Time zone: Etc/UTC (UTC, +0000)
System clock synchronized: yes
              NTP service: active
          RTC in local TZ: no

Now it works.