Hi,
thanks for reply. Is ther any sort of code standard to install the new app like as below:
install.php:
<?php
// Set variables for our request
$shop = "testshop";
$api_key = "680798dc2c864xxxxx39b42cxxxx8";
$scopes = "read_orders,read_products,write_products,write_orders";
$redirect_uri = "http://exportleftovers.co/test_leopards/generate_token.php";
// Build install/approval URL to redirect to
$install_url = "https://" . $shop . ".myshopify.com/admin/oauth/authorize?client_id=" . $api_key . "&scope=" . $scopes . "&redirect_uri=" . urlencode($redirect_uri);
// Redirect
header("Location: " . $install_url);
die();
Now what will be code that i need to write for generating the token in 'generate_token.php'
generate_token.php:
require_once("inc/functions.php");
// Set variables for our request
$shop = "exportleftovers-development-shop";
$api_key = "680798dc2c864xxxxx39b42cxxxx8";
$shared_secret = "83f33c5bxxxxx3d4c37xxxxfe9ece";
$code = $_GET["code"];
$timestamp = $_GET["timestamp"];
$signature = $_GET["signature"];
// Compile signature data
$signature_data = $shared_secret . "code=" . $code . "shop=". $shop . ".myshopify.comtimestamp=" . $timestamp;
$query = array(
"Content-type" => "application/json", // Tell Shopify that we're expecting a response in JSON format
"client_id" => $api_key, // Your API key
"client_secret" => $shared_secret, // Your app credentials (secret key)
"code" => $code // Grab the access key from the URL
);
// Call our Shopify function
$shopify_response = shopify_call(NULL, $shop, "/admin/oauth/access_token", $query, 'POST');
// Convert response into a nice and simple array
$shopify_response = json_decode($shopify_response['response'], TRUE);
//echo var_dump($shopify_response);
// Store the response
$token = $shopify_response['access_token'];
// Show token (DO NOT DO THIS IN YOUR PRODUCTION ENVIRONMENT)
echo 'Success 1122: MY Token is '. $token;
-------------------------
when i remove the if condition 'if (md5($signature_data) === $signature) {'
than shopify generate the token.
Is there any expiry of token? Because something token is expire and i need to generate the token again.
thanks