Implementing authentication in Angular
In order to handle JWT-based token authentication, we need to set up our ASP.NET back-end and our Angular front-end to handle all the required tasks.
In the previous sections, we spent a good amount of time configuring the ASP.NET Core Identity services and middlewares, meaning that we’re halfway done; as a matter of fact, we’re almost done with the server-side tasks. At the same time, we did nothing at the front-end level; the sample users that we created in the previous section—admin@email.com
and user@email.com
—have no way to log in, and there isn’t a registration form to create new users.
However, if we think about what we did during the previous chapters, we should already know what to do to fill such a gap: implementing an interactive login (and possibly a registration) form, using the same techniques adopted for CityEditComponent
and CountryEditComponent
.
More specifically, here’s a...