Skip to content

Instantly share code, notes, and snippets.

@sandeepshetty
Created May 31, 2012 18:34
Show Gist options
  • Save sandeepshetty/2845304 to your computer and use it in GitHub Desktop.
Save sandeepshetty/2845304 to your computer and use it in GitHub Desktop.
shopify_oauth_authentication_url()
<?php
function shopify_oauth_authentication_url($shops_myshopify_domain, $api_key, $scope=array(), $redirect_uri='')
{
$scope = empty($scope) ? '' : '&scope='.implode(',', $scope);
$redirect_uri = empty($redirect_uri) ? '' : '&redirect_uri='.urlencode($redirect_uri);
return "https://$shops_myshopify_domain/admin/oauth/authorize?client_id=$api_key$scope$redirect_uri";
}
$auth_url = shopify_oauth_authentication_url('johns-group2130.myshopify.com', API_KEY, array('write_products'), 'http://localhost:8888/shopify/install.php');
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment