webdev
webdev
PD🧩 Plasmo Developers
Created by webdev on 6/16/2023 in #👟framework
Content Security Policy violation when importing Google Analytics
I followed the docs on Google Analytics and took a look at with-google-analytics example. I'm getting the following error when running production build of my extension:
Refused to load the script 'chrome-extension://www.googletagmanager.com/gtag/js?id=XXXXXXX&l=dataLayer&cx=c' because it violates the following Content Security Policy directive: "script-src 'self'". Note that 'script-src-elem' was not explicitly set, so 'script-src' is used as a fallback.
Refused to load the script 'chrome-extension://www.googletagmanager.com/gtag/js?id=XXXXXXX&l=dataLayer&cx=c' because it violates the following Content Security Policy directive: "script-src 'self'". Note that 'script-src-elem' was not explicitly set, so 'script-src' is used as a fallback.
Reproduction: - Follow with-google-analytics example - pnpm plasmo build - Load unpacked in Chrome (the production build) - Profit Was there something I missed here?
2 replies
PD🧩 Plasmo Developers
Created by webdev on 6/6/2023 in #👟framework
Firebase auth in background script
I have followed the with-firebase-auth example correctly. Once I sign in in the popup, it seems like auth is persisted to the options page as well, which is great. However, in the background script I just can't seem to get the auth working. It works for making unauthed Firestore requests though. This is how I initialize the background script: const app = initializeApp(FIREBASE_CONFIG); const db = getFirestore(app); const auth = getAuth(app); setPersistence(auth, browserLocalPersistence); Do you guys have a clue on how to do this?
6 replies