Skip to content
This repository has been archived by the owner on Nov 30, 2022. It is now read-only.

Commit

Permalink
Merge pull request #19 from ohmybrew/issue-18
Browse files Browse the repository at this point in the history
Issue 18 Investigation
  • Loading branch information
gnikyt authored Mar 19, 2018
2 parents f6604c5 + 37672d2 commit f996028
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/ShopifyApp/Middleware/AuthShop.php
Original file line number Diff line number Diff line change
Expand Up @@ -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...
Expand Down
3 changes: 1 addition & 2 deletions src/ShopifyApp/Traits/AuthControllerTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,14 @@ 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');
}

// Save shop domain to session
session(['shopify_domain' => ShopifyApp::sanitizeShopDomain($shopDomain)]);
session()->forget('shop');

if (!request('code')) {
// Handle a request without a code
Expand Down
2 changes: 1 addition & 1 deletion tests/Middleware/AuthShopMiddlewareTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

2 comments on commit f996028

@ncpope
Copy link
Contributor

@ncpope ncpope commented on f996028 Mar 20, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks this works great for me. I was experiencing the issue mentioned in #18 but I was unable to pinpoint the exact way to replicate it.

Thanks for keeping this updated @ohmybrew great work!

@gnikyt
Copy link
Owner Author

@gnikyt gnikyt commented on f996028 Mar 20, 2018 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.