Skip to content

Instantly share code, notes, and snippets.

@Ergin008
Created February 12, 2018 22:07
Show Gist options
  • Save Ergin008/b8081f90fc77c15b22edc8a6c93648a2 to your computer and use it in GitHub Desktop.
Save Ergin008/b8081f90fc77c15b22edc8a6c93648a2 to your computer and use it in GitHub Desktop.
SOAP Embedded Signing (C#)
// Construct the recipient token authentication assertion
// Specify ID, start time, method and domain
DocuSignWeb.RequestRecipientTokenAuthenticationAssertion assertion
= new DocuSignWeb.RequestRecipientTokenAuthenticationAssertion();
assertion.AssertionID = new Guid().ToString();
assertion.AuthenticationInstant = DateTime.Now;
assertion.AuthenticationMethod
= DocuSignWeb.RequestRecipientTokenAuthenticationAssertionAuthenticationMethod.Password;
assertion.SecurityDomain = "Request Recipient Token Test";
// Construct the URLs based on username
DocuSignWeb.Recipient recipient = envelope.Recipients[0];
DocuSignWeb.RequestRecipientTokenClientURLs urls = new DocuSignWeb.RequestRecipientTokenClientURLs();
String urlBase = baseURL;
urls.OnSigningComplete = urlBase + "?event=SignComplete&uname=" + recipient.UserName;
urls.OnViewingComplete = urlBase + "?event=ViewComplete&uname=" + recipient.UserName;
urls.OnCancel = urlBase + "?event=Cancel&uname=" + recipient.UserName;
urls.OnDecline = urlBase + "?event=Decline&uname=" + recipient.UserName;
urls.OnSessionTimeout = urlBase + "?event=Timeout&uname=" + recipient.UserName;
urls.OnTTLExpired = urlBase + "?event=TTLExpired&uname=" + recipient.UserName;
urls.OnIdCheckFailed = urlBase + "?event=IDCheck&uname=" + recipient.UserName;
urls.OnAccessCodeFailed = urlBase + "?event=AccessCode&uname=" + recipient.UserName;
urls.OnException = urlBase + "?event=Exception&uname=" + recipient.UserName;
// Request the token for a specific recipient
String token = _apiClient.RequestRecipientToken(status.EnvelopeID,
recipient.CaptiveInfo.ClientUserID, recipient.UserName,
recipient.Email, assertion, urls);
// Display token
Console.WriteLine("Recipient token is {0}", token);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment