diff --git a/lib/AuthHelper.php b/lib/AuthHelper.php index e879964..617f542 100644 --- a/lib/AuthHelper.php +++ b/lib/AuthHelper.php @@ -170,6 +170,10 @@ public static function getAccessToken() $response = HttpRequestJson::post($config['AdminUrl'] . 'oauth/access_token', $data); + if (CurlRequest::$lastHttpCode >= 400) { + throw new SdkException("The shop is invalid or the authorization code has already been used."); + } + return isset($response['access_token']) ? $response['access_token'] : null; } else { throw new SdkException("This request is not initiated from a valid shopify shop!");