Skip to content

Instantly share code, notes, and snippets.

@fditrapani
Created November 27, 2014 14:51
Show Gist options
  • Select an option

  • Save fditrapani/244913ca61eabfe89a8c to your computer and use it in GitHub Desktop.

Select an option

Save fditrapani/244913ca61eabfe89a8c to your computer and use it in GitHub Desktop.
// Set variables for our request
$shop = "demo-shop";
$request_headers = array(
"Content-type" => "application/json", // Tell Shopify that we're expecting a response in JSON format
"client_id" => "1r30mrvCFMfq2DLGuIXyY2veEJVgTtDD", // Your app API key
"client_secret" => "TBB5wltKarRtKn5mUVZck9RxHePNN6Jo", // Your app credentials (secret key)
"code" => $_GET["code"] // Grab the access key from the URL
);
// Call our Shopify function
$shopify_response = shopify_call(NULL, $shop, "/admin/oauth/access_token", $request_headers, 'POST', $request_headers);
// Convert response into a nice and simple array
$shopify_response = json_decode($shopify_response['response'], TRUE);
// Store the response
$token = $shopify_response['access_token'];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment