Why am I getting a 401 Unauthorized error on Shopify's App Bridge?

Solved

Why am I getting a 401 Unauthorized error on Shopify's App Bridge?

leindfraust
Shopify Partner
2 1 1

I'm having a 401 unauthorization error on our shopify-remix app.

Before April, the application we were working on was working properly, no errors or anything. No unauthorizations. Now this April, this 401 error has haunted us for 2 days now. I don't know why but the initiator of the error came from app-bridge.js. At first I thought it will just be solved by reinstallation, npm run config:link and use, reauthentication of the account, clearing cache and builds but to no avail, the 401 error just keeps on popping back.

leindfraust_0-1712040213699.png

1.png



Following this, I tried to remove any app bridge packages including app bridge types, still doesnt work, so what I tried is to use the app-bridge-react only, still not working. I've updated all the packages to their newest stable versions, refactored codebase to reflect changes on the shopify-remix-template. Still the same error. 

Lastly, what I've tried is just clone the repo and push it to another app on another organization and yes, it is now working. It is not throwing any 401 errors, just 403 (the one we were working require some permissions directly by shopify to be approved). I wonder what happened, why did I get 401 unauthorization on the current app we are working? Can someone help me please.

Accepted Solution (1)
leindfraust
Shopify Partner
2 1 1

This is an accepted solution.

Yes, disabling unstable_newEmbeddedAuthStrategy: false, on future flag solved this.

View solution in original post

Replies 4 (4)

appmaker23
Shopify Partner
2 0 0

@leindfraust Did you ever solve this?

leindfraust
Shopify Partner
2 1 1

This is an accepted solution.

Yes, disabling unstable_newEmbeddedAuthStrategy: false, on future flag solved this.

Lorenz22
Shopify Partner
5 0 3

Sometimes cross check stuff like secret key in our case they was a typo in the server. I thought it would be great to leave a note.

JoePichardo
Shopify Partner
13 0 2

Had a similar issue just now, I had to manually delete the Session row in my database to refresh the token so it can get the new scopes to the token. On my end, probably an issue with not setting up webhooks to update the token when there are app changes; app installation/deletion, scope changes, etc.