Skip to content
Bitzsoft.Integrationsbitzsoft.integrations

Reference

DocuSign 电子签章

DocuSign 电子签章服务——OAuth2 Bearer Token 鉴权,/envelopes API。

Last updated

基于 DocuSign eSignature REST API v2.1 实现,通过 OAuth2 Bearer Token 访问 /envelopes 端点。

包信息

  • NuGet 包:Bitzsoft.Integrations.ElectronicSignature.DocuSign
  • 接口:IElectronicSignatureProvider
  • 鉴权:OAuth2 Bearer Token(Authorization Code Grant 或 JWT,由调用方自行获取后注入)
  • Provider ID:DocuSign

配置

字段类型必填默认值说明
BaseUrlstringhttps://demo.docusign.net/restapi/v2.1/accounts/API 基地址(正式环境含 subdomain 和 accountId)
AccountIdstring账户 ID(accountId)
AccessTokenstringOAuth2 Bearer 访问令牌
TimeoutTimeSpan00:00:30HTTP 请求超时(文件上传/下载可调大)
HttpClientNamestringDocuSignElectronicSignatureProvider命名 HttpClient 标识
{
"DocuSign": {
"BaseUrl": "https://demo.docusign.net/restapi/v2.1/accounts/",
"AccountId": "your-account-id",
"AccessToken": "your-access-token",
"Timeout": "00:00:30"
}
}

注册

using Bitzsoft.Integrations.ElectronicSignature.DocuSign;
// 方式一:IConfiguration(默认读取 "DocuSign" 配置节)
services.AddBitzsoftDocuSignElectronicSignature(configuration);
// 方式二:委托配置
services.AddBitzsoftDocuSignElectronicSignature(options =>
{
options.BaseUrl = "https://demo.docusign.net/restapi/v2.1/accounts/";
options.AccountId = "your-account-id";
options.AccessToken = "your-access-token";
});

使用示例

var createResult = await provider.CreateContractAsync(new SimpleContractRequest
{
Title = "Service Agreement",
FileName = "agreement.pdf",
FileData = await File.ReadAllBytesAsync("agreement.pdf"),
SignerName = "John Doe",
SignerPhone = "john.doe@example.com"
});
var contractId = createResult.Data!;
var detail = await provider.GetContractDetailAsync(contractId);
var signUrl = await provider.GetSigningUrlAsync(contractId, "signer-id");

鉴权机制

  • 鉴权简化为 Bearer Access Token 模式,令牌的获取(Authorization Code Grant 或 JWT Grant)由调用方在外部完成。
  • 每个请求通过 Authorization: Bearer {token} 头携带令牌。

已知限制

不包含 Token 自动刷新;调用方需自行管理令牌生命周期,过期后更新 AccessToken 配置值。

100%

滚轮或按钮缩放 · 放大后拖动画面 · 双击切换 100% / 200%