[firebase_core] CSP support on Flutter web #9222
              
                Unanswered
              
          
                  
                    
                      atoka93
                    
                  
                
                  asked this question in
                Feature request
              
            Replies: 2 comments
-
| My teammates figured out a workaround: Setting up an  import * as firebaseCore from 'firebase/app';
import * as firebaseAnalytics from 'firebase/analytics';
window.firebase_core = firebaseCore;
window.firebase_analytics = firebaseAnalytics;and using  Kinda big workaround to circumvent unsafe-inline😕 | 
Beta Was this translation helpful? Give feedback.
                  
                    0 replies
                  
                
            -
| Thanks for your comment @atoka93! was of great help! For those looking for a step-by-step guide on how to do this, see my comment here: | 
Beta Was this translation helpful? Give feedback.
                  
                    0 replies
                  
                
            
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Goal: make Firebase Analytics work on web and avoid adding
unsafe-inlinetoscript-src.The content security policy for
script-srcis failing withContent Security Policy blocks inline execution of scriptsatt1.head.appendChild(script);,_injectSrcScript$body$FirebaseCoreWeb.Tested with:
firebase_core: 1.20.0andfirebase_analytics: 9.3.0.Including a fixed version of the
firebase-app.js,firebase-analytics.jsand using the old initializer used to work, but with the updated Firebase initialization (Firebase.initializeApp(options: ...)), which became mandatory to use, and automatic abstracted Firebase web initialization I didn't manage to make it work anymore and I can't think of a workaround.Latest version of the dependencies that worked (right before the JS Firebase SDK version was updated from 8.10.1 to 9+):
Beta Was this translation helpful? Give feedback.
All reactions