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.

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

报告相同问题?

悬赏问题

  • ¥15 BP神经网络控制倒立摆
  • ¥20 要这个数学建模编程的代码 并且能完整允许出来结果 完整的过程和数据的结果
  • ¥15 html5+css和javascript有人可以帮吗?图片要怎么插入代码里面啊
  • ¥30 Unity接入微信SDK 无法开启摄像头
  • ¥20 有偿 写代码 要用特定的软件anaconda 里的jvpyter 用python3写
  • ¥20 cad图纸,chx-3六轴码垛机器人
  • ¥15 移动摄像头专网需要解vlan
  • ¥20 access多表提取相同字段数据并合并
  • ¥20 基于MSP430f5529的MPU6050驱动,求出欧拉角
  • ¥20 Java-Oj-桌布的计算