App Bridge returns 401 error

Hey everyone,

I’m running into an issue with my app where, after reloading the page or navigating to the admin and then trying to go back to the app, I get a 401 Unauthorized error.

I built this app using Shopify CLI with Remix.

I’ve already tried a few things, but no luck so far:

  • Set unstable_newEmbeddedAuthStrategy to false

  • Made sure the SCOPES in .toml match the ones in .env

Has anyone faced this issue before and have any suggestions on what direction I should take?

Gesser0102_1-1743099414916.png

Hi @Gesser0102 ,

A 401 Unauthorized error in a Shopify Remix app usually indicates an authentication issue. Since you’re using Shopify CLI with Remix, here are some troubleshooting steps:

  1. Check App URL in Partners Dashboard

Make sure the app’s URLs in your Shopify Partner Dashboard match your development server. If they are incorrect, Shopify might not properly authenticate your app.

  1. Check Auth Callback and Session Storage

Confirm that your auth callback is working correctly. The authentication flow should store the session in your session storage.

If you’re using SQLite, Redis, or any other session storage, verify that sessions are being saved and retrieved correctly.

  1. Verify unstable_newEmbeddedAuthStrategy Usage

Since you set unstable_newEmbeddedAuthStrategy to false, it means you’re using the old authentication strategy.

Try setting it to true and check if the issue persists.

useEmbeddedApp({

unstable_newEmbeddedAuthStrat

egy: true

Hope these steps slove the issue. Let me know if you need more help.

Regards,

});

Thanks a lot!

I fixed the issue by deleting app_index.jsx from the app directory. That file was causing some conflicts with the routes and wasn’t actually being used by my app.