gnikyt / laravel-shopify

A full-featured Laravel package for aiding in Shopify App development
MIT License
1.24k stars 374 forks source link

App Proxy Invalid proxy signature. #725

Closed MGhufranKhalil closed 3 years ago

MGhufranKhalil commented 3 years ago

Invalid proxy signature.

I am getting Invalid proxy signature. error on using app proxy

here is my ajax:

$.ajax({ url:"https://sneakersurgeapp.test/proxy", type: "GET" }).done(function(data) { console.log(data); });

here is my app proxy setting image

here is my route Route::get('/proxy', [ 'uses' => 'App\Http\Controllers\CollectionProductsController@getCollectionProducts', 'as' => 'proxy.test' ])->middleware(['cors','auth.proxy']) ;

please help

gnikyt commented 3 years ago

You wouldn't send a AJAX request to proxy. Proxy is used to display a page on the Shopify store. It will verify the request came from Shopify and then display your view.

MGhufranKhalil commented 3 years ago

I am sending ajax from frontstore to laravel app.. isnt this possible?

my app url: https://sneakersurgeapp.test

gnikyt commented 3 years ago

So if /proxy is the route you use to display your view on the store... then you'd need to make another route to handle your AJAX requests.

/proxy => validates request from Shopify, displays your view on the shop

Make a new route /proxy/something, where you can send your AJAX requests to there, without the auth.proxy middleware.

MGhufranKhalil commented 3 years ago

I am unable to understand please look

Laravel: App URL : https://sneakersurgeapp.test Route I have create : https://sneakersurgeapp.test/proxy

Route::get('/proxy', [
'uses' => 'App\Http\Controllers\CollectionProductsController@getCollectionProducts',
'as' => 'proxy.test'
])->middleware(['cors','auth.proxy']) ;

Shopify Store URL: https://sshk-store.myshopify.com/ Proxy : https://sshk-store.myshopify.com/apps/proxy

my ajax

$.ajax({
url:"https://sneakersurgeapp.test/proxy",
type: "GET"
}).done(function(data) {
console.log(data);
});

getting Invalid proxy signature. error please correct my where I am wrong I will be really thankful

gnikyt commented 3 years ago

You dont send an AJAX request to your proxy URL.

Proxy page is for validation of the request from Shopify, and if validated, it will send back a view to Shopify.

I'm not sure you're understanding what proxy pages do. This is not a package issue from what I see, please move to discussions tab for help :)