Intuit QuickBooks OAuth signature_invalid-PHP

时间:2018-07-24 08:11:05

标签: php oauth quickbooks intuit-partner-platform intuit

我无法获取Quickbooks API的访问令牌来访问用户Quickbook的公司。 我正在使用Intuit示例OAuth代码:https://github.com/IntuitDeveloper/oauth-php

// step 1: get request token from Intuit = WORKING FINE
// step 2: send user to intuit to authorize = WORKING FINE
    if ( isset($_GET['oauth_token']) && isset($_GET['oauth_verifier']) ){
        // step 3: request a access token from Intuit
        $oauth->setToken($_GET['oauth_token'], $_SESSION['secret']);
        $access_token = $oauth->getAccessToken( OAUTH_ACCESS_URL ); // <<-- ERROR
        $_SESSION['token'] = serialize( $access_token );
        $_SESSION['realmId'] = $_REQUEST['realmId'];
        $_SESSION['dataSource'] = $_REQUEST['dataSource'];
        $realmId = $_SESSION['realmId'];
        $token = unserialize($_SESSION['token']);
    }

我成功获得了请求令牌和用户验证,但是当我尝试获取访问令牌时,它给了我一个错误。

OAuth访问URL = https://oauth.intuit.com/oauth/v1/get_access_token

响应:oauth_problem=signature_invalid

    [debugInfo] => Array
            (
  [headers_sent] => GET /oauth/v1/get_access_token?oauth_verifier=XX&oauth_consumer_key=XX&oauth_signature_method=HMAC-SHA1&oauth_nonce=XX&oauth_timestamp=XX&oauth_version=1.0&oauth_token=XX&oauth_signature=XX HTTP/1.1
    Host: XX
    User-Agent: PECL-OAuth/1.2.3
    Accept: *
  [headers_recv] => HTTP/1.1 401 Unauthorized
    Content-Type: text/plain
    Content-Length: 31
    Connection: keep-alive
    Keep-Alive: timeout=5
    Server: nginx
    Strict-Transport-Security: max-age=15552000
    intuit_tid: XX
    WWW-Authenticate: OAuth oauth_problem="signature_invalid"
    Cache-Control: no-cache, no-store
    Pragma: no-cache
  [body_recv] => oauth_problem=signature_invalid

            )

0 个答案:

没有答案