Hi everyone,
I’m trying to get the Javascript API working by following this: About the Connect JavaScript API
But I can’t get it working. I’m running into the problem “AP is not defined”.
I’m creating an add-on for confluence cloud.
I’m running this in my index.html:
<script src="https://connect-cdn.atl-paas.net/all.js"></script>
And try to call it in many different ways but this is my test:
useEffect(() => {
if (window.AP) {
console.log('AP is available');
} else {
console.error('AP is not available');
}
}, []);
Does anyone know how to get the API working on confluence cloud?
Edit:
What I could find is what looks like a problem with the CSP. Is it possible to edit the CSP headers of confluence cloud to allow unsafe inline?
“Refused to load the script ‘https://connect-cdn.atl-paas.net/all.js’ because it violates the following Content Security Policy directive: “script-src ‘self’ https://forge.cdn.prod.atlassian-dev.net ‘unsafe-inline’”. Note that ‘script-src-elem’ was not explicitly set, so ‘script-src’ is used as a fallback.”