I'm new to Shopify, I have to develop shopify app API using It's Shopify API in laravel 5. I have created app in my Development store, but when I am trying to install it on store it's giving authentication error.
As per documentation when user click on install app it redirects to the application callback url with access code as 'code'
parameter in url string.
by using this code we need to call verify request method to generate permanent Access Token.
When I'm trying to do this shopify is redirecting me to the callback url but there is no 'code'
in list.
I have set callback url in my app which is my localhost url converted by ngrok url (http://36481603.ngrok.io
) by using this url I am redirecting user to my API controller where I have below code...
$sh = App::make('ShopifyAPI');
try
{
$verify = $sh->verifyRequest(Input::all());
if ($verify)
{
$code = Input::get('code');
$accessToken = $sh->getAccessToken($code);
}
else
{
// Issue with data
}
}
catch (Exception $e)
{
echo '<pre>Error: ' . $e->getMessage() . '</pre>';
}
Please provide if there is a step-by-step documentation for new app development in shopify.
Thanks in advance.
By using this code we need to call verify request method to generate permanent Access Token..
I dont think you are right in this context, the verify request method does not generate access token but verifies the validity of the request.
Anytime anyone clicks on your app to install your app shopify appends four items to the query string which are code, signature, shop, timestamp.
You need to construct a url with the shop url to obtain the access token which in this case i dont know whether you are doing it write with your encapsulated method. eg. $url = "https://{$shop}/admin/oauth/access_token". And sending your apikey as client_id, api_secret as client_secret, and the code you obtained from the url as code to form and send as a post request to shopify to obtain the access token.