diff --git a/shopify.php b/shopify.php index 6598b13..76ac4d4 100644 --- a/shopify.php +++ b/shopify.php @@ -40,10 +40,12 @@ function access_token($shop, $api_key, $shared_secret, $code) { try { - return http\request("POST https://$shop/admin/oauth/access_token", array(), array('client_id'=>$api_key, 'client_secret'=>$shared_secret, 'code'=>$code)); + $response = http\request("POST https://$shop/admin/oauth/access_token", array(), array('client_id'=>$api_key, 'client_secret'=>$shared_secret, 'code'=>$code)); } catch (http\CurlException $e) { throw new CurlException($e->getMessage(), $e->getCode(), $e->getRequest()); } catch (http\ResponseException $e) { throw new ApiException($e->getMessage(), $e->getCode(), $e->getRequest(), $e->getResponse()); } + + return $response['access_token']; }