以下代码会返回错误消息:
Invalid auth/bad request (got a 401, expected HTTP/1.1 20X or a redirect)
{"messages":{"error":[{"code":401,"message":"oauth_problem=signature_invalid"}]}}
有人知道解决方案吗?当我创建产品并尝试将其分配到某个类别时,就会发生这种情况。
try {
$authType = ($_SESSION['state'] == 2) ? OAUTH_AUTH_TYPE_AUTHORIZATION : OAUTH_AUTH_TYPE_URI;
$oauthClient = new OAuth($consumerKey, $consumerSecret, OAUTH_SIG_METHOD_HMACSHA1, $authType);
$oauthClient->enableDebug();
//Creating the product here and straight after assiging it to a category
} catch (OAuthException $e) {
print_r($e->getMessage());
echo '<br/>';
print_r($e->lastResponse);
}