Kyon147 / laravel-shopify

A full-featured Laravel package for aiding in Shopify App development
MIT License
363 stars 107 forks source link

Infinite redirecation to authentication/token route #223

Closed jalpab closed 7 months ago

jalpab commented 11 months ago

Install the latest version of the package and also install the latest Laravel but getting continuously redirect and unable to redirect home route after authenticated. Please help how can fix this.

Package Version: v19.1 Laravel Version: v9.5 PHP Version: v8.2

Kyon147 commented 11 months ago

This is a known issue which I find hard to replicate - it happens on blade only as they use the token.blade which has a redirect path in it. Sometimes the redirect path gets set as it self - so creates the infinite loop.

We just need to create a PR to stop this edge case from happening and redirect to home if the url is the token blade route.

Can you create a PR?

jalpab commented 11 months ago

Can you please explain to me what I need to add in this PR?

emmanuelizzy commented 10 months ago

Any luck with this issue? I'm currently facing this and everything I have tried seems not to work.

And for some reason, Shopify is still trying to access /authenticate/oauth route which is no longer in this package. Thoughts on this

Kyon147 commented 10 months ago

@jalpab @emmanuelizzy we need to check in the authenticate/token route if the redirect is set as the same page. If it is, we need to update the redirect url to be the home route i.e / that way it should fix the infinite loop.

emmanuelizzy commented 10 months ago

Thank you so much for your quick response. Unfortunately, I'm still unable to resolve this @Kyon147 ... After lots of messing with the code, I noticed that setting "forceRedirect" to false (see attached) on the default.blade.php stops the infinite loop but doesn't move past the authenticate/token page.

The package seems to work fine for embedded apps but in my case, I have the embed app option disabled in the app setting, as I want to redirect users to the app outside of Shopify's iframe, maybe this is why the package is not handling this aspect of the authentication properly.

Any help to get past this point will be greatly appreciated, it's been a really frustrating 3days on this infinite loop issue

Screenshot 2023-11-21 at 12 01 15
Kyon147 commented 10 months ago

@emmanuelizzy the package does not support non-embedded apps.

At the moment you can only use it for inside the iframe. This is probably why you are getting the issue as we've not set up the app to be outside the embed.

emmanuelizzy commented 10 months ago

Any plans to add support for non-embedded apps this year @Kyon147 as this option was available in the old package ?*

Kyon147 commented 10 months ago

@emmanuelizzy no I have no plans to start it this year (as there is only a month left), it is not a small piece of work to get the support added in. So I am looking for others to also help with it if they wish to use it.

I don't make apps usually sit outside the Shopify iframe (as there's more perks to have it in the admin) so I rarely spend time looking into what is actually needed for it.

I'll probably look into it sometime next year but when depends on my workload.

muzammilshahzad894 commented 7 months ago

My issue is fixed when I follow this.

image

Kyon147 commented 7 months ago

Great closing this PR now.