使用C#在JWT上出现DocuSign'invalid_grant'错误

时间:2019-03-01 18:54:00

标签: c# docusignapi

我是尝试使用DocuSign API的新手。我在尝试使用Git上可用的代码运行示例时遇到问题。我已经设置了所有属性,并且无法运行任何示例。尝试使用JWT时,出现以下异常:

请求服务器时出错,接收失败  HTTP代码,带有响应正文: {"error":"invalid_grant"}

this.Host = (host != null) ? host : "https://demo.docusign.net/restapi";
this.Username = (username != null) ? username : {my acct email here};
this.Password = (password != null) ? password : {my acct pswd here};
this.IntegratorKey = (integratorKey != null) ? integratorKey : {my integrator key here};

this.RecipientEmail = (recipientEmail != null) ? recipientEmail : {recipient email here};
this.RecipientName = (recipientName != null) ? recipientName : {recipient name here};

this.TemplateRoleName = (templateRoleName != null) ? templateRoleName : "bob"; - DEFALTED NOT ME
this.TemplateId = (templateId != null) ? templateId : "cf2a46c2-8d6e-4258-9d62-752547b1a419"; - DEFAULTED NOT ME

this.ReturnUrl = (returnUrl != null) ? returnUrl : "https://www.docusign.com/devcenter";

this.UserId = {My acct GUID HERE};
this.OAuthBasePath = "account-d.docusign.com";
this.PrivateKeyFilename = "../../../docs/private.pem";
this.ExpiresInHours = 1;

this.EnvelopeIdsList = new List<string>();

this.IntegratorKeyNoConsent = "66750331-ee4b-4ab8-b8ee-6c1a413a6096"; - DEFAULTED NOT ME
this.PrivateKeyNoConsentFilename = "../../../docs/privateKeyConsentReq.pem";

任何帮助将不胜感激!预先感谢

1 个答案:

答案 0 :(得分:0)

请从C# Auth Code Grant示例开始。这是一个现成的Visual Studio解决方案。