diff --git a/src/ShopifyApp/Middleware/AuthShop.php b/src/ShopifyApp/Middleware/AuthShop.php index ab1bdfb2..c761b411 100644 --- a/src/ShopifyApp/Middleware/AuthShop.php +++ b/src/ShopifyApp/Middleware/AuthShop.php @@ -30,7 +30,7 @@ public function handle(Request $request, Closure $next) // Either no shop session or shops do not match session()->forget('shopify_domain'); - return redirect()->route('authenticate')->with('shop', $shopParam); + return redirect()->route('authenticate', ['shop' => $shopParam]); } // Shop is OK, move on... diff --git a/src/ShopifyApp/Traits/AuthControllerTrait.php b/src/ShopifyApp/Traits/AuthControllerTrait.php index bea2347c..6c874093 100644 --- a/src/ShopifyApp/Traits/AuthControllerTrait.php +++ b/src/ShopifyApp/Traits/AuthControllerTrait.php @@ -26,7 +26,7 @@ public function index() public function authenticate() { // Grab the shop domain (uses session if redirected from middleware) - $shopDomain = request('shop') ?: session('shop'); + $shopDomain = request('shop'); if (!$shopDomain) { // Back to login, no shop return redirect()->route('login'); @@ -34,7 +34,6 @@ public function authenticate() // Save shop domain to session session(['shopify_domain' => ShopifyApp::sanitizeShopDomain($shopDomain)]); - session()->forget('shop'); if (!request('code')) { // Handle a request without a code diff --git a/tests/Middleware/AuthShopMiddlewareTest.php b/tests/Middleware/AuthShopMiddlewareTest.php index 2acc396a..267c6fee 100644 --- a/tests/Middleware/AuthShopMiddlewareTest.php +++ b/tests/Middleware/AuthShopMiddlewareTest.php @@ -47,7 +47,7 @@ public function testShopsWhichDoNotMatchShouldKillSessionAndDirectToReAuthentica }); $this->assertFalse($called); - $this->assertEquals('example-different-shop.myshopify.com', session('shop')); + $this->assertEquals('example-different-shop.myshopify.com', request('shop')); } public function testHeadersForEsdkShouldBeAdjusted()