我是BigCommerce以及插件的完整菜鸟。最近计划开发一个单击应用程序,可以由商店的任何商店的用户安装。我有很好的手上的PHP。所以,我可以编码,但不知道插件的流程。 要创建草稿应用程序,我去了devtools.bigcommerce.com并创建了一个应用程序定义的Auth Callback网址为https://amanangira.com/bCommerce/oauth.php 并将回调网址加载为https://amanangira.com/bCommerce/callBack.php
在oauth.php中我插入了以下代码
<?php
$data = array( "client_id" => "123456789",
"client_secret" => "123456789",
"redirect_uri" => "https://amanangira.com/bCommerce/callBack.php",
"grant_type" => "authorization_code",
"code" => $_GET["code"], "scope" => $_REQUEST["scope"], "context" => $_GET["context"], );
$postfields = http_build_query($data);
$ch = curl_init();
//$url = "https://api.bigcommerce.com/stores/wky4s3lfef/v3/";
$url = "https://login.bigcommerce.com/oauth2/token";
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch,CURLOPT_HTTPHEADER,array('Content-Type: application/x-www-form-urlencoded'));
curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$output = curl_exec ($ch);
curl_close ($ch);
$obj = json_decode($output);
var_dump($obj);
?>
现在每当我在我的测试商店中安装应用程序时,它都会说明。
/var/www/html/angira/bCommerce/oauth.php:37: 对象(stdClass的)[3] public'error'=&gt; string'redirect_uri_mismatch'(长度= 21) public'error_description'=&gt; string'参数redirect_uri与注册的URI不匹配'(长度= 52)
请尽可能简单地说明上述内容。 谢谢。
答案 0 :(得分:0)
"redirect_uri" => "https://amanangira.com/bCommerce/oauth.php"