gnikyt / laravel-shopify

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

Cant send a ajax request #1125

Closed officialGerero closed 2 years ago

officialGerero commented 2 years ago

When im trying to send a AJAX request, from my app page, that i get to from shopify apps, im getting a redirect from route that im trying access, to authenticate.

My route : Route::get('/add-script-tags', [ShopifyController::class, 'addScriptTags'])->middleware('verify.shopify')->name('add-script-tags'); My ajax call:

$.ajax({
                url : $(this).attr('href'),
                type: 'get',
                headers: {
                    Authorization: `Bearer ${window.sessionToken}`,
                },
            });

Header is added but still isnt recognized by the middleware, or am i missing something?

officialGerero commented 2 years ago

My bad, request had accept / insted of json

Kyon147 commented 2 years ago

Closing as it looks like you've solved it 👍