douzen1880 2013-11-18 22:12
浏览 39
已采纳

Quickbooks API访问令牌signature_invalid

I am having trouble getting an access token for the Quickbooks API. I successfully get a request token and user verification, but when I run this code:

$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, 'https://oauth.intuit.com/oauth/v1/get_access_token?oauth_consumer_key=qyprdNDNZ9hEhZgwZBBia6ZDkwpRtP&oauth_nonce=HUPXw&oauth_signature=raVWgofhFJpAtES9e0mqlxe0I2k%3D&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1384812231&oauth_token=qyprdWLEO99zeQjkz3C75A6bJxLYMgOESy9PQDS4IIUZ9fY3&oauth_verifier=7unnxvg&oauth_version=1.0');
$r = curl_exec($ch);
print $r;

... it prints "oauth_problem=signature_invalid". What am I doing wrong?

  • 写回答

1条回答 默认 最新

  • dtid30526 2013-11-19 13:41
    关注

    You didn't really post enough code for us to tell you what's going on. My bet would be that you aren't generating your OAuth signature or request correctly.

    Can you post the rest of your code?

    OAuth is a pretty non-trivial topic - you might consider using one of the existing PHP DevKits for QuickBooks which does all of this hard work (and a lot of other hard work) for you.

    Using the QuickBooks PHP DevKit linked above, authorizing/getting these tokens is as simple as:

    <?php
    
    /**
     * Require the QuickBooks library
     */
    require_once dirname(__FILE__) . '/../../QuickBooks.php';
    
    /**
     * Require some IPP/OAuth configuration data
     */
    require_once dirname(__FILE__) . '/config.php';
    
    // Try to handle the OAuth request 
    if ($IntuitAnywhere->handle($the_username, $the_tenant))
    {
            ; // The user has been connected, and will be redirected to $that_url automatically. 
    }
    else
    {
            // If this happens, something went wrong with the OAuth handshake
            die('Oh no, something bad happened: ' . $IntuitAnywhere->errorNumber() . ': ' . $IntuitAnywhere->errorMessage());
    }
    

    A good place to start is in the example QuickBooks PHP app and following the PHP + Intuit Anywhere quick-start guide.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 5037端口被adb自己占了
  • ¥15 python:excel数据写入多个对应word文档
  • ¥60 全一数分解素因子和素数循环节位数
  • ¥15 ffmpeg如何安装到虚拟环境
  • ¥188 寻找能做王者评分提取的
  • ¥15 matlab用simulink求解一个二阶微分方程,要求截图
  • ¥30 乘子法解约束最优化问题的matlab代码文件,最好有matlab代码文件
  • ¥15 写论文,需要数据支撑
  • ¥15 identifier of an instance of 类 was altered from xx to xx错误
  • ¥100 反编译微信小游戏求指导