Why does it keep redirecting to login

Hello
I am new to developing Shopify plugins, and I keep running into an issue. When I submit a form, it keeps redirecting me to “login“. I was following this tutorial: Build a Shopify app using React Router , and I even went ahead and downloaded that repo GitHub - Shopify/example-app--qr-code--remix and the same problem occurred using 100% that code.

The steps I took, was:

  1. Download the repo
  2. Npm install
  3. shopify app dev
  4. Choose “new shopify app”
  5. Press “p“ to preview, and then created a QR code.

Som additional informail:

  1. I am using version 2025-10, but it also occurs on other versions
  2. The qr code is created even though I am redirected to the login page
  3. Looking at the log, it seems like the first requests have shop: null, and says redirecting to login page, but then the following requests says “session is valid”. I also added logging in the form code, and could see that the form code was happening after the “invalid“.
  4. When above is said, I could also get it somewhat to work if I commented out all other authenticate than the one in the form, and it didn’t matter which I re-added.

I hope somebody can point me in the right direction so I don’t run into this issue.

You can try adding event.preventDefault(); to the handleSave function in the app.qrcodes.$id.jsx file.