App frame refusing to load on reloading for 4 times.

Solved
New Member
2 0 0

Thanks a lot. I have fixed it


@sunitha_iqz wrote:

We have figured this one out. The tutorial doesn't make it obvious but Shopify seems to check for an auth loop whenever the root url ('/') of the application is accessed.

The tutorial has code like the following:Screenshot from 2019-10-29 11-34-33.pngSee the ctx.redirect('/') there? That's the offending piece of code. In trying to check for a loop, Shopify is incorrectly flagging a legitimate access url access as a bad one.

 

The fix:

It's quite simple. Never redirect to root in your application. Move the main page of your app to something like '/home' and do this instead:

ctx.redirect('/home');

Make sure that the route home is available and you are good to go.

Shopify should probably update their docs to mention this.


 

0 Likes
New Member
3 0 0

I have been with stuck with the same problem for over a week. I cannot seem to find a solution. I am not using koa so, I don't have same ctx.redirect in my codebase. I am using node.js and express.js and following this tutorial. https://help.shopify.com/en/api/tutorials/build-a-shopify-app-with-node-and-express

 

Would you be able to provide a hint on where I would need to fix the redirect issue with the above tutorial?

0 Likes
Excursionist
15 2 2

In the tutorial you mentioned, you need to replace 

 

res.status(200).end(shopResponse); 

The above statement ends your response with a json response without redirecting anywhere.

with the following after requesting access token from shopify

 

 

res.redirect('/home');

And make sure to serve the route '/home'.

 

Hope this works!

 

0 Likes
New Member
3 0 0

I am already using absolute path. This is what it looks like with the actual code.

 

https://pastebin.com/JJc0sEFj

0 Likes
Excursionist
15 2 2
In that case redirect to your app by appending your shopify key associated with the application to your link https://${shop}/admin/apps/<your-api-key/

Something like this would work
0 Likes
New Member
1 0 0

I can't use Sesami because of the 3rd party cookie block.  What is the solution, please.

0 Likes