Shopify Session Id missing in OAuth::callback method

Shopify Session Id missing in OAuth::callback method

Rishab1
Shopify Partner
2 0 1

 

hello Everyone,

I am using shopify/shopify-api package in my embedded app created in laravel. here is my code of context initialization

 

Context::initialize(
            env('SHOPIFY_API_KEY'), 
        env('SHOPIFY_API_SECRET_NEW'),
         $scope,
          env('APP_URL'),
          new ShopifySessionStorage(),
           env('SHOPIFY_API_VERSION'),
           true);

 

then i call the OAuth begin function from my landing-page route which is "/". here is the code :

 

$redirect_uri = '/auth-callback';
        $isOnline = false;
        $redirectURl = OAuth::begin(
            $shop,
            $redirect_uri,
            $isOnline,
            ['App\Lib\CookieHandler', 'saveShopifyCookie']
        );

 

here is the code of saveShopifyCookie function:

 

 public static function saveShopifyCookie(OAuthCookie $cookie)
    {
         setcookie($cookie->getName(),$cookie->getValue(),60,'/');
return true;
}

 

 

 in auth-callback url route i called OAuth::callback function and pass cookie as first argument and request query as second argument 

 

$session = OAuth::callback(
                $cookie_value,
                $request->query(),
            );

 

 

err.png

 

Replies 0 (0)