Skip to main content
Question

DocuSignJS Focus View: Frame-Ancestors Issue with Recipient View URL in C# SDK

  • April 1, 2025
  • 1 reply
  • 23 views

Hi,

I'm developing a service that returns a sign-embedded URL for the front end using the .NET (C#) SDK
 

var docuSignClient = await CreateClientAsync();

var envelopesApi = new EnvelopesApi(docuSignClient);

var recipientViewRequest = new RecipientViewRequest
{
    AuthenticationMethod = "none",
    ClientUserId = recipientId.ToString(),
    ReturnUrl = returnUrl,
    UserName = recipientName,
    Email = recipientEmail,
    FrameAncestors = new List<string> { "http://localhost:7777", "https://apps-d.docusign.com" },
    MessageOrigins = new List<string> { "https://apps-d.docusign.com" }
};

var viewUrl = await envelopesApi.CreateRecipientViewAsync(_docuSignConfiguration.APIAccountId, envelopeId.ToString(), recipientViewRequest);

return viewUrl.Url;

However, when I use the returned URL with DocuSignJS Focus View, I get the following error:

Refused to frame 'https://apps-d.docusign.com/' because an ancestor violates the following Content Security Policy directive: "frame-ancestors 'none'".

 

I've already set the FrameAncestors for the recipientViewRequest, but I'm not sure what I’m missing.

Could someone help me understand why this is happening? Below is my code, and I’d really appreciate any insights into what I might be doing wrong.

Thank you!

1 reply

Forum|alt.badge.img+7

By design, the focused view allows the customer to do whatever they need to do on the page by using the event handlers. That is, even though you get the CSP error, you can redirect the page by adding the line "window.top.location.href" under "sessionEnd" event handler like the below:

signing.on('sessionEnd', (event) => {
console.log('sessionend', event);
window.top.location.href = event.returnUrl; // redirect to the return Url
});


The error CSP is caused as your redirect URL is not registered in the CSP by Docusign. But it doesn't matter to redirect your page to the target page with the code above.