laravel-shopify icon indicating copy to clipboard operation
laravel-shopify copied to clipboard

Infinite redirect

Open sandyrewa opened this issue 3 years ago • 12 comments

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: v17.1
  • Laravel Version: v8.54
  • PHP Version: v8.0

image

sandyrewa avatar Sep 04 '21 12:09 sandyrewa

I got the same problem on fresh install of Laravel and laravel-shopify. It infinite redirects between authenticate/token and home controller.I tried with WAMP and with Laravel built-in server, still the same problem.

  • Laravel-Shopify v17.1
  • Laravel framework v7.30.4
  • PHP v7.3.29

lara-shopify

vlkf avatar Sep 05 '21 12:09 vlkf

Downgrading Laravel-Shopify package to v16.0.6 resolved the problem for me.

vlkf avatar Sep 07 '21 13:09 vlkf

@vlkf Thanks, it's also working for me with v16.0.6, but I read an article where Shopify reject the app which is created on v16

sandyrewa avatar Sep 07 '21 19:09 sandyrewa

@ClaraLeigh I have done the changes as you mentioned but still getting 302 infinite redirect loops on my local machine but it's working fine server.

sandyrewa avatar Nov 29 '21 19:11 sandyrewa

@sandyrewa I don't think its in any of the releases yet, only master.

To get it working for me, I had to essentially clone the VerifyShopify middleware, and the SessionToken.php, make the changes there and use my custom middleware instead. I think I made a couple of other changes too.... I just had to get it out the door essentially, I've been so busy lately.

I'll probably make some more PRs later but I'm pretty busy till Jan

ClaraLeigh avatar Dec 01 '21 03:12 ClaraLeigh

Thanks @ClaraLeigh! Your solution worked for us :-) It took us few hours to figure out it is still not in the release, we were sure by now it's there so we didn't check. I wonder it is not in any release yet. Amos

amosmos avatar Mar 31 '22 05:03 amosmos

@amosmos Can you please tell us what exactly needs to be done, it's still not working for us? Thanks

sandyrewa avatar Mar 31 '22 05:03 sandyrewa

@sandyrewa Do you use one app for many stores with different api_key for each store? I'm asking because this is the problem that this fix is fixing. If you only have one api_key then i think you probably have a different problem and that's perhaps why you still have it after making this change. Amos

amosmos avatar Mar 31 '22 05:03 amosmos

@amosmos Thanks for the quick reply, I'm creating a public app that uses only one api_key.

sandyrewa avatar Mar 31 '22 05:03 sandyrewa

@sandyrewa So I think you have a different issue because this issue is only caused if you rely on a specific store to get a specific api_key. The code in this fix shouldn't make any effect on your case.

Just guessing here, but check these things: Are you sure you saved the environment parameters correctly for the api_key and api_secret? Also make sure you disabled the server environment for X-Frame-Options "SAMEORIGIN" (look here: https://github.com/osiset/laravel-shopify/wiki/Installation#appbridge) Also, are you using your own route for the home route? If so make sure you follow the instructions to properly set the route and the view, and if you're not, make sure you remove the default home route you get from laravel, look here: https://github.com/osiset/laravel-shopify/wiki/Installation#routing Lastly, I don't know if it's related or not, but perhaps the CSRF setting is also important for the flow (I'm not sure because the request supposed to be GET but I didn't check), so if nothing else works it's worth a shot, look here: https://github.com/osiset/laravel-shopify/wiki/Installation#csrf

Hope it helps, Amos

amosmos avatar Mar 31 '22 06:03 amosmos

@amosmos ok, thanks for your help will check

sandyrewa avatar Mar 31 '22 06:03 sandyrewa

Could this be related to #1179?

LeafedFox avatar Sep 14 '22 11:09 LeafedFox