首页 > 解决方案 > qs-01-php-embed-signing-ceremony.php 用户不属于帐号问题

问题描述

USER_DOES_NOT_BELONG_TO_SPECIFIED_ACCOUNT在尝试进行身份验证时遇到错误的 DocuSign API 问题。

首先,我在网站中设置了一个 url。url 带有我的 api 密钥和重定向地址。用户单击以访问它。转到account-d.docusign.com登录页面并登录以授权我。我通过返回的授权码获得了访问令牌,然后调用了embedded_signing_ceremony返回信封视图的方法。我设置$ accountId为我自己的 API 帐户 ID 出了点问题。

Caught exception: Error while requesting server, received a non successful HTTP code [400] with response Body: O: 8: "stdClass": 2: {s: 9: "errorCode"; s: 41: "USER_DOES_NOT_BELONG_TO_SPECIFIED_ACCOUNT"; s: 7: "message"; s: 60: "The specified User is not a member of the specified Account.";} DocuSign API error information: string (166) "O: 8:" stdClass ": 2: {s: 9 : "errorCode"; s: 41: "USER_DOES_NOT_BELONG_TO_SPECIFIED_ACCOUNT"; s: 7: "message"; s: 60: "The specified User is not a member of the specified Account.";} "
function embedded_signing_ceremony($user_name,$user_sub,$user_email,$user_token){
    #
    # The document $fileNamePath will be signed by <signer_name> via an
    # embedded signing ceremony.

    # Settings
    # Fill in these constants
    #
    # Obtain an OAuth access token from https://developers.docusign.com/oauth-token-generator
    $accessToken=$user_token;
   # Obtain your accountId from demo.docusign.com -- the account id is shown in the drop down on the
    # upper right corner of the screen by your picture or the default picture. 
    $accountId ="0fe939e9-73bb-48e3-8887-e32d581ba578";  
  # Recipient Information:
    $signerName = $user_name;
    $signerEmail =$user_email;
    # The document you wish to send. Path is relative to the root directory of this repo.
    $fileNamePath = 'qs-php-master/demo_documents/World_Wide_Corp_lorem.pdf';
    # The url of this web application's folder. If you leave it blank, the script will attempt to figure it out.
    $baseUrl = '';
    $clientUserId =$user_sub; #  Used to indicate that the signer will use an embedded
                        # Signing Ceremony. Represents the signer's userId within
                        # your application.
    $authenticationMethod = 'None'; # How is this application authenticating
                                    # the signer? See the `authenticationMethod' definition
                                    # https://developers.docusign.com/esign-rest-api/reference/Envelopes/EnvelopeViews/createRecipient

    # The API base_path
    $basePath = 'https://demo.docusign.net/restapi';

    # Constants
    $appPath = getcwd();

当用户 account_id 设置为 时$accountId,我可以返回信封查看 url,但这不是我想要的结果,应该是我创建了信封并显示给用户签名

我想知道怎么设置才能达到我想要的效果

标签: phpdocusignapi

解决方案


使用 JWT 时使用了两个 GUID:

  1. AccountID - 这是正在使用的整个帐户。
  2. UserID - 这是将被模拟的用户。

现在,当您尝试调用 API 时,它将使用上面 #2 中的用户。该帐户位于 URL 上,您的环境是 Demo/Sandbox。

确保所有三个都指向同一个地方——URL 指向正确的环境,userId 和 accountID 与您正在使用的特定帐户以及来自正确环境的正确用户匹配。


推荐阅读