In a real scenario, we usually delegate all the heavy lifting on an authentication service that wraps all the necessary tools for handling user login, logout, and sometimes authentication for granting access to protected areas of our application.
we will create a simplified version of such service and will put it in charge of handling user login along with the component we just created in the previous section. This service will also manage auth token persistence and provide methods to check if the user has access granted to secure pages. Before jumping into the code, let’s summarize the minimum requirements this service must fulfil: - We need its API to expose a method to handle user login - User logout must be handled as well by a public method in this API - A third method or property should inform if the user is logged in or not so they can proceed to secured pages - Having an observable property informing of the current state of the active user for authentication will become handy to make the overall UI more reactive read full tutorial <https://www.dunebook.com/how-to-set-up-authentication-and-authorization-in-angular-2/> -- You received this message because you are subscribed to the Google Groups "AngularJS" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
