There's more...
Practically speaking, having a user service that just creates an arbitrary user isn't very useful in a real application. Sharing application state across many different parts has a variety of uses, but without a real authentication service, our current user service has a limited prototyping use at this time.
However, we could expand our service to work with an authentication strategy, such as JSON web token (JWT), to be set by an authentication service, such as angular2-jwt. Setting up authentication requires a backend service to provide and enforce the authorization layer. We will dive into this subject in depth in Chapter 5, REST APIs and Authentication, when we will discuss how to use Express for our backend APIs.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access