Could not find the current session id in the cookies

olaide
Visitor
1 0 5

I started having this error from my shopify app Oauth implementation sometime last week.

I am using the shopify/shopify-api PHP package for this implementation.

 

The below implementation is from the callback url supplied in the shopify app settings

try {
$callback = OAuth::callback(
cookies: \request()->cookies->all(),
query: \request()->input(),
);
} catch (\Throwable) {
return \redirect()->intended(request()->headers->get('referer'));
}

 

The error log shows as follows:

 

Shopify\Exception\CookieNotFoundException: Could not find the current session id
in the cookies in /var/www/pac/releases/260/vendor/shopify/shopify-api/src/Auth/OAuth.php:277

Stack trace: #0 /var/www/pac/releases/260/vendor/shopify/shopify-api/src/Auth/OAuth.php(124): Shopify\Auth\OAuth::getCookieSessionId() #1 /var/www/pac/releases/260/app/Http/Api/V1/Controllers/Shopify/ShopifyController.php(81): Shopify\Auth\OAuth::callback() #2 /var/www/pac/releases/260/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(54): App\Http\Api\V1\Controllers\Shopify\ShopifyController->authCallback()

 

Replies 2 (2)
Happiness
Shopify Partner
20 0 14

Hi! I've started to receive the same error. Looks like it works fine when run in dev but when build a production version it will show this error. The issue is the same for the app developed five month ago and for a fresh app built on a PHP 8 with this package https://github.com/Shopify/shopify-app-template-php/tree/main

Does anyone knows what can cause the problem?

Happiness
Shopify Partner
20 0 14

@olaide Have you solved the issue somehow?