Kyon147 / laravel-shopify

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

Issues with Redirect::tokenRedirect() #119

Closed KevinSHansen closed 1 year ago

KevinSHansen commented 1 year ago

For bug reporting only! If you're posting a feature request or discussion, please ignore.

Expected Behavior

I expect the app to redirect to the view as told.

Current Behavior

When i perform a POST from a form like this: <form method="POST" action="{{ route('shipments.multiprint') }}">

Then i handle the data and try to redirect the customer like this: return Redirect::tokenRedirect('shipments');

Then the app goes to the shopify "loading page" and nothing more happens.

I then tried dd() the Redirect link and manually tried to go to the link which redirected me to this: https://undefined/admin/apps......

Have anyone tried this?

slashcart commented 1 year ago

if its non-spa try sending token with host and shop while redirecting.

KevinSHansen commented 1 year ago

if its non-spa try sending token with host and shop while redirecting.

Can you tell me how thats done? :)

slashcart commented 1 year ago

image this is how redirecting from middleware

Kyon147 commented 1 year ago

As @slashcart mentioned you need to pass the shop and host params - host must be on every single request if you are not using an SPA.

The only thing to note, is not to build the host param yourself. You should only ever get the host param from Shopify as building it manually from the shop name is not consistent and can cause errors.

Going to close this for now.

KevinSHansen commented 1 year ago

As @slashcart mentioned you need to pass the shop and host params - host must be on every single request if you are not using an SPA.

The only thing to note, is not to build the host param yourself. You should only ever get the host param from Shopify as building it manually from the shop name is not consistent and can cause errors.

Going to close this for now.

That fixed the issue! Thanks :)