简体   繁体   English

我需要 Docusign API 身份验证方面的帮助

[英]I need assistance with Docusign API Authentication

I have tried authentication using DocuSign API .我已尝试使用DocuSign API 进行身份验证。

When I send the request using jQuery ajax, I keep getting the "Access-Control-Allow-Origin" Header error.当我使用 jQuery ajax 发送请求时,我不断收到“Access-Control-Allow-Origin”标题错误。

When I try with PHP curl, I don't get any response.当我尝试使用 PHP curl 时,我没有得到任何响应。 Do you have any idea of the issue.??你对这个问题有什么想法吗??

If you need more details, you can ask in the comments.如果您需要更多详细信息,可以在评论中询问。 Thanks in advance.提前致谢。

https://account-d.docusign.com/oauth/token&response_type=code&scope=signature&client_id=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx&state=a39fh23hnf23&redirect_uri=https://www.google.com/ is not a REST URL, it is a browser interaction, you need to open browser to open this link, then you need to enter DocuSign credential of the person for whom you want to get the access token. https://account-d.docusign.com/oauth/token&response_type=code&scope=signature&client_id=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx&state=a39fh23hnf23&redirect_uri=https://www.google.com/不是REST URL,它是浏览器交互,您需要打开浏览器打开此链接,然后您需要输入要为其获取访问令牌的人的DocuSign 凭据。 If the authentication is successful, the authentication service redirects the user to the redirect_uri (browser to browser interaction).如果认证成功,认证服务会将用户重定向到redirect_uri(浏览器到浏览器交互)。 The callback contains a code that you will exchange for a token in the next step.回调包含您将在下一步中交换令牌的代码。 With this code, you will use OAUTH REST API to get the access token.通过此代码,您将使用 OAUTH REST API 来获取访问令牌。 Details are available at https://docs.docusign.com/esign/guide/authentication/oa2_auth_code.html详情请见https://docs.docusign.com/esign/guide/authentication/oa2_auth_code.html

The url which you are trying should only be accessed on a browser not using AJAX or any REST API tool, as it is a normal web application url.您尝试的 url 只能在不使用 AJAX 或任何 REST API 工具的浏览器上访问,因为它是一个普通的 web 应用程序 url。 After you receive the code in the callback then you can use Rest Tool to get the access token.在回调中收到代码后,您可以使用 Rest Tool 获取访问令牌。 I hope before you started trying this flow, you have correctly setup the integrator Key with the redirect_uri and secretKey, as these two items will be required to get a successfull accesstoken.我希望在您开始尝试此流程之前,您已使用 redirect_uri 和 secretKey 正确设置了集成器密钥,因为这两项是成功获取访问令牌所必需的。

Thanks for the reply Ergin.感谢埃尔金的回复。 Here is what i tried.这是我尝试过的。

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://account-d.docusign.com/oauth/token&response_type=code&scope=signature&client_id=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx&state=a39fh23hnf23&redirect_uri=https://www.google.com/",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_FOLLOWLOCATION => 1,
  CURLOPT_SSL_VERIFYHOST => false,
  CURLOPT_HTTPHEADER => array(
    "cache-control: no-cache",
    "postman-token: a51a80ff-b741-3d19-4fd5-1099f034e1ae"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
   print_r($response);
}

I am not sure about what headers to use in here, but I've tried using the code from Postman and it still doesn't work.我不确定在这里使用什么标头,但我已经尝试使用 Postman 的代码,但它仍然不起作用。 Thanks谢谢

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM