I am creating app but, the here I am getting strange error The redirect_uri is not whitelisted but, I already defined the url properly:
https://www.purchasetheme.com/justboughtit/generate_token.php
In the code as well it is define properly:
// Redirect URI must be whitelisted in Shopify app settings
$redirect_uri = “https://www.purchasetheme.com/justboughtit/generate_token.php”;
// Generate secure random state
$state = bin2hex(random_bytes(16));
$_SESSION[‘oauth_state’] = $state;
// Save incoming host param for later
if (!empty($_GET[‘host’])) {
$_SESSION[‘host’] = $_GET[‘host’];
}
session_write_close();
// — Build OAuth URL —
$install_url = “https://$shop/admin/oauth/authorize?” .
“client_id=” . urlencode($api_key) .
“&scope=” . urlencode($scopes) .
“&redirect_uri=” . urlencode($redirect_uri) .
“&state=” . urlencode($state);
// Include host param if present (for embedded apps)
if (!empty($_GET[‘host’])) {
$install_url .= “&host=” . urlencode($_GET[‘host’]);
}
// Redirect user to Shopify install screen
header(“Location: $install_url”);
exit;
please please help to fix it.