gladly-team / next-firebase-auth

Simple Firebase authentication for all Next.js rendering strategies
https://nfa-example-git-v1x-gladly-team.vercel.app/
MIT License
1.34k stars 291 forks source link

Firebase loads a large iframe.js file but only on mobile #599

Closed G-Nation closed 1 year ago

G-Nation commented 1 year ago

Describe the bug Hello to everyone, I am having the same issue as the one mentioned in this thread: https://github.com/firebase/firebase-js-sdk/issues/4946. I was wondering if its possible to give a solution to it using the next-firebase-auth because the given solutions in the thread talks about using the initializeAuth() with some params instead of using getAuth(). This is not possible using next-firebase-auth as the initAuth function does all this work. What can i do to solve this issue? As im having a really low performance metrics on the mobile version.

Thank you in advance and have happy holidays!!!

Versions

next-firebase-auth version: ^1.0.0-canary.9 Firebase JS SDK: ^9.9.0 FirebaseUI: ^6.0.1 Next.js: ^12.1.5

kmjennison commented 1 year ago

@G-Nation You should be able to set whatever properties you need in firebaseClientInitConfig. You can also initialize the Firebase SDK yourself prior to initializing next-firebase-auth. Let me know if you run into any problems with these approaches!

G-Nation commented 1 year ago

The problem is that the properties don't go on the firebaseClientInitConfig they go on the initialization of the Auth module so i can't include it on the properties.

const auth  = initializeAuth(app, {
  persistence: [
    indexedDBLocalPersistence,
    browserLocalPersistence,
    browserSessionPersistence,
  ],
});
kmjennison commented 1 year ago

Got it. Would it work to initialize the Firebase SDK yourself prior to initializing next-firebase-auth? This library will use the default app if one's already initialized.

G-Nation commented 1 year ago

Sorry but i forgot to answer, I tryied to initialize the Firebase SDK with the options mentioned above and then use the initAuth as you suggested and everything worked fine and the large iframe.js file disappeared.

Thank you very much!!!

EvertonMJunior commented 10 months ago

Sorry but i forgot to answer, I tryied to initialize the Firebase SDK with the options mentioned above and then use the initAuth as you suggested and everything worked fine and the large iframe.js file disappeared.

Thank you very much!!!

@G-Nation Sorry to reopen this, but would you mind posting how you did it? I'm having the same problem and didn't get a result with your description of how you solved it. Thanks!