How can I access shopify app on localhost on localhost:8081?

So I’ve created a node app using Shopify node create

It is working fine on the Shopify development store but I wanted to access the app locally as well
When I try to access localhost:8081, it redirects me to https://undefined/admin/oauth/authorize?

In other words, I wanted to access the app from the browser, not from the Shopify store.

What is the solution?

TIA

This redirect happens due to app bridge. In the _app.js file, inside the app bridge config object, you can change the forceRedirect to false to stop the redirect.

1 Like

Thank You so much @mkamalkayani - I wish I can give you more than 1 likes lol

One more question - is there a way to run the app on the localhost without NGROK for the development? because NGROK really slows down the development.
NOTE: by follow forceRedirect as false.

I am glad it helped.

Yes, it’s possible. The shopify cli generates a nextjs application with a custom koa server.

Instead of shopify serve command, you can use ‘node server.js’ to run the koa server without ngrok. In this case your app would be non embedded and you cannot use app bridge components.

1 Like

I tried, but in this case, it does not even allow me to access the app.

Without ngrok, the app will be available on your localhost address only.