How to add app url

apatuka
Visitor
2 0 1

Hello, i creatd an app but i dont know where to add Api URL because i have this error:

 

Oauth error invalid_request: The redirect_uri and application url must have matching hosts
 
And this is my code:
 

<?php
require('vendor/autoload.php');

$config = array(
'ShopUrl' => '*******',
'ApiKey' => '*******',
'Password' => '*******',
'Curl' => array(
CURLOPT_TIMEOUT => 10,
CURLOPT_FOLLOWLOCATION => true
)
);

PHPShopify\ShopifySDK::config($config);

$scopes = 'read_products,write_products';
$redirectUrl = 'http://localhost:81/shopify/app.php';
\PHPShopify\AuthHelper::createAuthRequest($scopes, $redirectUrl);
?>

 

Can you provide me help or a detailed tutorial how to achieve this ?

 

Thank you

Reply 1 (1)

garyrgilbert
Shopify Partner
391 40 162

You can't use localhost as your redirectURL.  If you are developing on your local machine you need to either use NGROK or Localtunnel to act as a passthrough to your local host.

 

 

Cheers,

 

Gary

- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution