Angular 5 onAuthStateChanged never called
See original GitHub issueI 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:
- Created 6 years ago
- Reactions:4
- Comments:8 (3 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.
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.