Skip to content

Commit b7dc4b7

Browse files
authored
Merge pull request #219 from liamjcooper/fix/access-token-exception
Throw an exception if the access token request failed
2 parents 27ccacf + fe7e971 commit b7dc4b7

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/AuthHelper.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,10 @@ public static function getAccessToken()
170170

171171
$response = HttpRequestJson::post($config['AdminUrl'] . 'oauth/access_token', $data);
172172

173+
if (CurlRequest::$lastHttpCode >= 400) {
174+
throw new SdkException("The shop is invalid or the authorization code has already been used.");
175+
}
176+
173177
return isset($response['access_token']) ? $response['access_token'] : null;
174178
} else {
175179
throw new SdkException("This request is not initiated from a valid shopify shop!");

0 commit comments

Comments
 (0)