Magento REST API:oauth_problem = signature_invalid

Ben*_*der 5 oauth magento

以下代码返回错误消息:

Invalid auth/bad request (got a 401, expected HTTP/1.1 20X or a redirect)
{"messages":{"error":[{"code":401,"message":"oauth_problem=signature_invalid"}]}}
Run Code Online (Sandbox Code Playgroud)

有人知道解决方案吗?它发生在我创建产品并尝试将其分配到类别时.

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);
}
Run Code Online (Sandbox Code Playgroud)