Skip to content

Commit 415e8ff

Browse files
committed
getAccessToken() throws exception if request is not valid
1 parent bd33053 commit 415e8ff

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/AuthHelper.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ public static function createAuthRequest($scopes, $redirectUrl = null)
118118
* Get Access token for the API
119119
* Call this when being redirected from shopify page ( to the $redirectUrl) after authentication
120120
*
121-
* @throws SdkException if SharedSecret or ApiKey is missing in SDK configuration
121+
* @throws SdkException if SharedSecret or ApiKey is missing in SDK configuration or request is not valid
122122
*
123123
* @return string
124124
*/
@@ -140,6 +140,8 @@ public static function getAccessToken()
140140
$response = HttpRequestJson::post($config['AdminUrl'] . 'oauth/access_token', $data);
141141

142142
return isset($response['access_token']) ? $response['access_token'] : null;
143+
} else {
144+
throw new SdkException("This request is not initiated from a valid shopify shop!");
143145
}
144146
}
145147
}

0 commit comments

Comments
 (0)