angular - Do I need an Angularfire2 Authentication Service? -
i working on project angular 4 , firebase.
currently, in every component needs access firebase authentication, add constructor. however, takes bit realize user logged in when loads.
for single-page application, isn't of problem, however, using routing, every time switch page, new component has loaded scratch.
would making service handle authentication in background solve issue?
two things:
- your authentication should done in service (logging in, logging out, checking auth state, etc.)
- you should setup guards prevent routes being accessed unless specific criteria met (ie, user logged in).
Comments
Post a Comment