【问题标题】:PARTNER_AUTHENTICATION_FAILED after succesfull geting access token using JWT使用 JWT 成功获取访问令牌后 PARTNER_AUTHENTICATION_FAILED
【发布时间】:2019-05-16 20:05:44
【问题描述】:
  1. 我正在尝试在我的应用程序和 DocuSign 沙盒之间建立连接。

  2. 我正在使用 JWT 授权。

  3. 我已生成带有 RSA 私钥的集成密钥。
  4. 我让用户模拟 GUID 并征得同意
  5. 我用正确的数据调用https://account-d.docusign.com/oauth/token 并成功响应并返回访问令牌

直到此刻,一切都运行良好。

我已经下载了 PHP "docusign/esign-client" 的库

并使用了这段代码:

        $recipientId = uniqid(5);
        $clientUserId =  uniqid(5);

        $document = new Document([
            'document_base64' => $base64FileContent,
            'name' => 'Application Form',
            'file_extension' => 'pdf',
            'document_id' => '1'
        ]);

        $signer = new Signer([
            'email' => $email,
            'name' => $name,
            'recipient_id' => $recipientId,
            'routing_order' => "1",
            'client_user_id' => $clientUserId,
        ]);

        $signHere = new SignHere([
            'document_id' => '1', 'page_number' => '3', 'recipient_id' => $recipientId,
            'tab_label' => 'SignHereTab', 'x_position' => '195', 'y_position' => '147'
        ]);

        $signer->setTabs(new Tabs(['sign_here_tabs' => [$signHere]]));

        $envelopeDefinition = new EnvelopeDefinition([
            'email_subject' => "Please sign this document",
            'documents' => [$document],
            'recipients' => new Recipients(['signers' => [$signer]]),
            'status' => "sent"
        ]);

        $config = new Configuration();
        $config->setHost('https://demo.docusign.net/restapi');
        $config->addDefaultHeader("Authorization", "Bearer " . $accessToken);
        $config->setAccessToken($accessToken);

        $apiClient = new ApiClient($config);
        $envelopeApi = new EnvelopesApi($apiClient);

        $results = $envelopeApi->createEnvelope($integrationKey, $envelopeDefinition);  

结果是一个错误(400)来自带有信息的 API:

PARTNER_AUTHENTICATION_FAILED
The specified Integrator Key was not found or is disabled. Invalid account specified for user.

它说集成密钥错误,但在我使用此集成密钥成功生成访问令牌之前几行。

你知道出了什么问题吗?

在 JWT 集成之前,我使用不同的集成密钥和来自 OAuth 令牌生成器的访问令牌,它工作正常(之前的密钥没有生成 RSA)

你们能帮我解决这个问题吗?

如果有更多信息可以帮助找到解决方案,请告诉我,我会更新我的帖子。

感谢您的帮助。

【问题讨论】:

    标签: php docusignapi


    【解决方案1】:

    问题出在这一行

     $results = $envelopeApi->createEnvelope($integrationKey, $envelopeDefinition);
    

    createEnvelope 方法的第一个参数应该是 Account ID,而不是积分键。

    收到访问令牌后,您可以拨打UserInfo 并从中提取帐户ID。

    【讨论】:

    • 对,问题是 accountId,现在它可以正常工作了。谢谢。
    • 嗨,我已经这样做了,我的代码与上面的代码几乎相同,但在添加帐户 ID 后仍然出现相同的错误。这里有什么想法吗?
    • @JonathanPort - 为用户指定的帐户无效通常意味着您访问了错误的基本 URL。进行身份验证后,进行 UserInfo 调用并从中提取 BaseUrl 以确保以后的 API 调用针对正确的服务器。在 Demo 中只有一个端点 (demo.docusign.net),但在 Production 中有多个。
    猜你喜欢
    • 2021-10-03
    • 2020-09-28
    • 2015-08-20
    • 1970-01-01
    • 2017-10-23
    • 2019-11-29
    • 2023-03-30
    • 2019-12-08
    • 2018-01-13
    相关资源
    最近更新 更多