Skip to content
This repository has been archived by the owner on Apr 4, 2023. It is now read-only.

Angular 5 onAuthStateChanged never called #588

Closed
giorgiopiatti opened this issue Dec 28, 2017 · 8 comments
Closed

Angular 5 onAuthStateChanged never called #588

giorgiopiatti opened this issue Dec 28, 2017 · 8 comments
Milestone

Comments

@giorgiopiatti
Copy link

giorgiopiatti commented Dec 28, 2017

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.

@giorgiopiatti giorgiopiatti changed the title Angular 5 onAuthChange never called Angular 5 onAuthStateChanged never called Dec 28, 2017
@anuragd7
Copy link

anuragd7 commented Dec 29, 2017 via email

@EddyVerbruggen
Copy link
Owner

If anyone can share a simple project reproducing this issue then I'm glad to take a look. In the meanwhile, please compare your code to the Angular demo app in this repo which seems to work fine.

@giorgiopiatti
Copy link
Author

@EddyVerbruggen I've used the demo app code, forking directly from this repository and updating to Angular 5.1.0 as showed there https:/giorgiopiatti/nativescript-plugin-firebase/tree/master/demo-ng

Thanks ;)

@Socha17
Copy link

Socha17 commented Jan 16, 2018

Also having this issue

@EddyVerbruggen
Copy link
Owner

Are you implying with Angular 5.0.0 it was working fine?

@NicholasSmilovic
Copy link

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.

@giorgiopiatti
Copy link
Author

giorgiopiatti commented 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.

@EddyVerbruggen
Copy link
Owner

See #613.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants