我的目標:獲取令牌以發送數字簽名請求(服務器到服務器)環境:PHP、Symfony - 演示環境這是我在運行以下代碼時收到的錯誤:錯誤:“consent_required”我的代碼:class ServiceSignature{ private $container; private $accessToken; private $accountId; private $signerName; private $signerEmail; private $fileNamePath; private $basePath; private $appPath; public function __construct(ContainerInterface $container) { $this->container = $container; $this->accountId = "dc295354-xxxx-xxxx-xxxx-f2e3a8813b1e"; $this->basePath = 'https://demo.docusign.net/restapi'; $this->appPath = $_ENV["FOLDER_UPDATE"]; $this->accessToken = ""; $this->private_key_path = "../docusign_private.pem"; $this->private_key = file_get_contents($this->private_key_path); $this->cle_integration = "bdfeaf70-xxxx-xxxx-xxxx-8a2ed57eb7ef"; $this->audience = "account-d.docusign.com"; $this->permission_scopes= "signature impersonation"; $this->token = $this->getToken(); } public function getToken() { $current_time = time (); $_token = [ "iss" => $this->cle_integration, "sub" => $this->accountId, "aud" => $this->audience, "scope" => $this->permission_scopes, "nbf" => $current_time, "exp" => $current_time + 60*1000 ]; $jwt = JWT::encode($_token, $this->private_key, 'RS256'); $headers = ['Accept' => 'application/json']; $data = ['grant_type' => 'urn:ietf:params:oauth:grant-type:jwt-bearer', 'assertion' => $jwt]; $body = Unirest\Request\Body::form($data); $response = Unirest\Request::post("https://{$this->audience}/oauth/token", $headers, $body); if (strpos($response->raw_body, '<html>') !== false) { throw new Exception("An error response was received!\n\n"); } $json = $response->body; dump($json); die(); }}先感謝您
1 回答

LEATH
TA貢獻1936條經驗 獲得超7個贊
問題很可能是您提供的用戶 GUID 尚未同意。
按照本指南獲得同意,您應該一切順利。
摘錄:
當應用程序進行身份驗證以代表用戶執行操作時,將要求該用戶對應用程序請求的范圍集(權限集)授予同意,除非他們之前已經授予該同意。
要開始身份驗證并獲得同意,您的應用程序會將用戶的瀏覽器重定向到 DocuSign 授權 URI。請注意,這不是標準的 GET 請求,不能由應用程序直接發送。相反,用戶的瀏覽器被重定向到授權請求 URI,請求從那里發送到帳戶服務器。
- 1 回答
- 0 關注
- 224 瀏覽
添加回答
舉報
0/150
提交
取消