Skip to content

Commit

Permalink
Acknowledge nonce during auth
Browse files Browse the repository at this point in the history
  • Loading branch information
Richtermeister committed Oct 1, 2017
1 parent 985d918 commit cca9d67
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Controller/OAuthController.php
Expand Up @@ -84,11 +84,13 @@ public function auth(Request $request)

$verifyUrl = $this->router->generate('codecloud_shopify_verify', [], UrlGeneratorInterface::ABSOLUTE_URL);
$verifyUrl = str_replace("http://", "https://", $verifyUrl);
$nonce = uniqid();

$params = [
'client_id' => $this->config['api_key'],
'scope' => $this->config['scope'],
'redirect_uri' => $verifyUrl,
'state' => $nonce,
];

$shopifyEndpoint = 'https://%s/admin/oauth/authorize?%s';
Expand All @@ -107,6 +109,7 @@ public function verify(Request $request)
{
$authCode = $request->get('code');
$storeName = $request->get('shop');
$nonce = $request->get('state');

if (!$authCode || !$storeName) {
throw new BadRequestHttpException('Request is missing required parameters: "code", "shop".');
Expand Down

0 comments on commit cca9d67

Please sign in to comment.