Iām trying to implement an OAuth flow to connect my teamās DAM to a Figma plugin to allow us to fetch assets from the DAM from Figma. At the moment Iām running into a CSP error when I try to use Figma.showUI.
Note: Using more generic URLs here
In main.ts:
figma.showUI(
`<script>window.location.href = "https://oauth.vercel.app"</script>`,
{height: 640, width: 440}
)
The full console error reads:
Refused to execute inline script because it violates the following Content Security Policy directive: ādefault-src data: blob: https://company.dam.com https://oauth.vercel.appā. Either the āunsafe-inlineā keyword, a hash (āsha256-Q+8tPsjVtiDsjF/Cv8FMOpg2Yg91oKFKDAJat1PPb2g=ā), or a nonce (ānonce-ā¦ā) is required to enable inline execution. Note also that āscript-srcā was not explicitly set, so ādefault-srcā is used as a fallback.
I tested it by replacing window.location.href = "https://oauth.vercel.app" with my own personal website (and added my personal siteās URL to networkAccess.allowedDomains) which worked. Iām unsure now why Iām getting the inline script error.
