Copy link to clipboard
Copied
Good afternoon,
I am facing the problem that after creating an api key and authorizing the domain csites.rinnen-clervaux.com I get the error: This application domain (https://csite.rinnen-clervaux.com:8443) is not authorized to use the provided PDF Embed API Client ID.
I am using the testcode:
<div id="adobe-dc-view"> </div>
<!-- Light Box --><script src="https://documentcloud.adobe.com/view-sdk/main.js"></script><script type="text/javascript">
document.addEventListener("adobe_dc_view_sdk.ready", function(){
var adobeDCView = new AdobeDC.View({clientId: "4c2f21c1449e45a7a5274ce59fccb357", divId: "adobe-dc-view"});
adobeDCView.previewFile({
content:{location: {url: "https://documentcloud.adobe.com/view-sdk-demo/PDFs/Bodea Brochure.pdf"}},
metaData:{fileName: "Bodea Brochure.pdf"}
}, {embedMode: "LIGHT_BOX"});
});
</script>
API KEY
4c2f21c1449e45a7a5274ce59fccb357
Copy link to clipboard
Copied
Assuming your API key and domain are correct, try removing the divId parameter. It's not necessary for LIGHT_BOX.
Copy link to clipboard
Copied
Good morning Joel,
thanks for the advice but the error persists.
I already deleted the credetials and created new ones but without success.
Best regards
Mirko
Copy link to clipboard
Copied
Okay I got a bit further the problem seems to be that the subdomain csite is pointing to another ip than the domain itself.
Putting the file on the server to which the domain is pointing, everything is running fine.
So that means, there is perhaps a problem with the subdomain on another ip.
Creating credentials separately for the subdomain does not work.
Best regards
Mirko
Copy link to clipboard
Copied
Try creating credentials with just the domain, no subdomain. Just "rinnen-clervaux.com"
Copy link to clipboard
Copied
I already did that. That's how the credentials are actually but the same error reoccurs.
Must be something IP based I think. Lets assume that when creating the credentials only the domain is considered and not the subdomain, then it is quite clear why this is not working.
The ip from rinnen-clervaux.com is expected but the subdomain csite is pointing to another ip.
So no authorization granted. Would make sende because if I run the same script from rinnen-clervaux.com it works flawlessly.
Best regards
Mirko
Copy link to clipboard
Copied
Are you sure it's not a CORS issue? I generally recommend not using content.location.url to pass the PDF. There isn't enough error handling that way. Instead, fetch the PDF first, handle any errors, check the mine type, then when you know for sure that you have the PDF, pass it in as a Promise that resolves to a ByteArray.
I have an example of pre-fetching the PDF and delaying the display of the viewer until the pdf is rendered at this CodePen.
Copy link to clipboard
Copied
Well I am using the example adobe example code which is already working fine on the www domain.
On every other subdomain the credeetials do not seem to be valid.
Rgds
Mirko
Copy link to clipboard
Copied
Have you ruled out CORS issues?
Copy link to clipboard
Copied
Yes, I adapted the code you provided via CodePen with the same result:
"This application domain (https://csite.rinnen-clervaux.com:8443) is not authorized to use the provided PDF Embed API Client ID."
Best regards
Mirko
Copy link to clipboard
Copied
You are right. Now looking into the console output I see that there are several problems setting a cookie in a cross site request.
"Because a cookie's Same Site attribute was not set or is invalid, it defaults to SameSite=Lax, which prevents the cookie from being sent in a cross-site request. This behavior protects user data from accidentally leaking to third parties and cross-site request forgery."
Thats the message I get. I activated Header add Access-Control-Allow-Origin "*" in the vhosts conf file but without success.
Rgds
Mirko
Copy link to clipboard
Copied
This code is recommended by adobe and checking the console I get a 401 error meaning I am unauthorized.
Besides I get problems with cross site cookies. So this does not seem to be usable on subdomains.
<div id="adobe-dc-view" style="height: 500px; width: 750px;"></div>
<script src="https://documentcloud.adobe.com/view-sdk/main.js"></script>
<script type="text/javascript">
document.addEventListener("adobe_dc_view_sdk.ready", function(){
var adobeDCView = new AdobeDC.View({clientId: "4c2f21c1449e45a7a5274ce59fccb357", divId: "adobe-dc-view"});
adobeDCView.previewFile({
content:{location: {url: "https://csite.rinnen-clervaux.com:8443/AutoAttendant.pdf"}},
metaData:{fileName: "UK-COVID-19.pdf"}
}, {embedMode: "SIZED_CONTAINER"});
});
</script>
Rgds
Mirko