Skip to content
This repository has been archived by the owner on Nov 30, 2022. It is now read-only.

Infinite redirect #962

Open
sandyrewa opened this issue Sep 4, 2021 · 12 comments
Open

Infinite redirect #962

sandyrewa opened this issue Sep 4, 2021 · 12 comments
Labels
help-wanted Contributor help would be nice!

Comments

@sandyrewa
Copy link

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

@vlkf
Copy link

vlkf commented Sep 5, 2021

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
Copy link

vlkf commented Sep 7, 2021

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

@sandyrewa
Copy link
Author

@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

ClaraLeigh added a commit to ClaraLeigh/laravel-shopify that referenced this issue Nov 1, 2021
Fixes an issue where the verifyValidity() function checks the api token against the global api_key instead of any shop specific token.
Also fixes an infinite loop error that was occurring for myself, possibly related to: gnikyt#962
gnikyt pushed a commit that referenced this issue Nov 17, 2021
Fixes an issue where the verifyValidity() function checks the api token against the global api_key instead of any shop specific token.
Also fixes an infinite loop error that was occurring for myself, possibly related to: #962
@sandyrewa
Copy link
Author

@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.

@ClaraLeigh
Copy link
Contributor

@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

@Kyon147 Kyon147 added the help-wanted Contributor help would be nice! label Mar 13, 2022
@amosmos
Copy link
Contributor

amosmos commented Mar 31, 2022

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

@sandyrewa
Copy link
Author

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

@amosmos
Copy link
Contributor

amosmos commented Mar 31, 2022

@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

@sandyrewa
Copy link
Author

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

@amosmos
Copy link
Contributor

amosmos commented Mar 31, 2022

@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

@sandyrewa
Copy link
Author

@amosmos ok, thanks for your help will check

@LeafedFox
Copy link
Contributor

Could this be related to #1179?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
help-wanted Contributor help would be nice!
Projects
None yet
Development

No branches or pull requests

6 participants