question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Angular 5 onAuthStateChanged never called

See original GitHub issue

I was trying to see if there weren’t any issues with this plugin and the last version of nativescript (3.4) and angular (5.0.0)…

When I try to subscribe to the event

onAuthStateChaged 

from the init method or by calling the listener, nothing is triggered. Nothing is passed to the callback function.

Update

I’ve investigated a bit more and I found out that the error happens when I initialize firebase, in fact the initialization is never completed but no error is caught by the promise. When I also try to use other functions, it give me the message that I must run the initialization first.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:4
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
giorgiopiatticommented, Jan 17, 2018

Thankyou @NicholasSmilovic Wrapping firebase.init inside a 1-second timeout resolved the issue. setTimeout(()=>{ firebase.init(()=>{...}) },1000)

@EddyVerbruggen No also with Angular 5.0.0, wasn’t working but with the suggestion of Nicholas also is solved.

1reaction
NicholasSmiloviccommented, Jan 16, 2018

I believe I was having a similar problem. After firebase.init I was able to login, but the onAuthStateChange Listener was not firing. Putting firebase.init inside a 1 second timeout made it operational. This happened on angular 5, and maybe 4 too.

Read more comments on GitHub >

github_iconTop Results From Across the Web

why this function not return any value? - Stack Overflow
I am new to Angular. I am trying to create a function for check user is logged in or not but function in...
Read more >
onAuthStateChanged firing incrementally each time I log in ...
I'm working off of the SBAdmin Dashboard template and attempting to add Firebase auth. I have a log in state with the LoginController....
Read more >
Auth | JavaScript SDK | Firebase JavaScript API reference
Do not call this constructor directly. Instead, use firebase.auth() . ... onAuthStateChanged(function(user) { if (user) { // User is signed in. } }); ......
Read more >
How to use Angular Guards to protect your pages in Ionic apps
We're going to use the onAuthStateChanged() method, it connects to Firebase Authentication and listens to changes in the user state to respond to...
Read more >
Firebase Auth in your Ionic 5 App for iOS and Android - Medium
Ionic 5 App. Install AngularFire and Firebase. ... It shows a SignUp/SignIn option if the user is not logged in; It shows a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found