adobe / adobe/pdf-embed-api-samples

Embed API - CSP issue with promise

Open
#50 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
235
Forks
140
PR merge metrics
No merged PRs in 30d

Description

I have been using the API and providing a URL and not having any problems but when I switch to using the promise I am getting an error back in the console and the file doesn't load. It looks as if the error is in the viewer.js

I get the error:

"Refused to execute inline event handler because it violates the following Content Security Policy directive: "script-src 'self' use.typekit.net assets.adobedtm.com [www.adobe.com/marketingtech/](http://www.adobe.com/marketingtech/) prod.adobeccstatic.com/utilnav/ widget.uservoice.com by2.uservoice.com/t2/ assets.adobe.com api.demandbase.com/api/v2/ip.json commerce.adobe.com". Either the 'unsafe-inline' keyword, a hash ('sha256-...'), or a nonce ('nonce-...') is required to enable inline execution. Note that hashes do not apply to event handlers, style attributes and javascript: navigations unless the 'unsafe-hashes' keyword is present."

Is there something I need to add to my CSP Header to prevent this?

To reproduce the error here's what I am doing using I am using https://documentservices.adobe.com/view-sdk/viewer.js

var adobeDCView = new AdobeDC.View({
clientId: {clientId},
divId: "adobe-dc-view",
});

adobeDCView.previewFile({
content: {
promise: readFile(buffer),
},
metaData: {
fileName: "FileName"
}
}, {});
}

Any help would be greatly appreciated.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.