From the course: Building Angular and ASP.NET Core Applications
Unlock the full course today
Join today to access over 24,500 courses taught by industry experts.
Handling authentication
From the course: Building Angular and ASP.NET Core Applications
Handling authentication
- [Instructor] We created the Auth Zero account and the authentication service. So now, it's time to use the service in our app. Currently in our app, any user can just come here, add a book, update a book, or even see all the books. Now but, we should allow only the authenticated users to interact with our data. So let's go to Visual Code and see this in action. In here we'll go inside the ClientApp, source, app, components, and then nav-menu. Let us first go to the nav-menu.component.ts file and here we need to inject the authentication service. For that we write, constructor, then private. We are going to name this service auth, and then AuthService. Now let us go to our nav-menu.component.html file. We can close the debug window because we don't need that window. And then here, what we want to do is that we want to display only the buttons that the user needs to see. So for example, if the user is not…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.