Angular 6 - Login and Logout with Web API using Token Based Authentication in 20 Minutes

Опубликовано: 14 Май 2026
на канале: DotNet Techy
79,758
379

Hi All,
In this tutorial I am showing you , how you can achieve the authentication in angular 6 using web api and OWIN middle ware to generate the token after validating the user name and password.
What all you will learn in this tutorial is:
So let us discus here what problem this video resolves.
How to create login form in angular 6
How to do token based authentication in web api
How to use access token in angular 6 applications
How to get token from web api using angular service
How to store token in angular 6
How to remove token in angular 6
How to implement logout in angular 6
How to create reactive login form in angular 6
How to pass token to restful service.
How to use bearer authentication in angular and web api
How to use auth guard in angular
How to use CanActivate method in angular


Token based authentications in Angular 6
Authorizations in Angular 6
Using Authentications in Angular 6
Using authorizations in Angular 6
Auth guard in Angular 6
CanActivate in Angular 6
routing and auth guard in angular 6
WEB api access token
token based authentication in web api
token based authentication in rest api
token based authentication spring
token based authentication c#
token based authentication angular 6
token based authentication in angular 6
token based authentication in angular 5
angular 5 authentication example
angular 6 authentication example
routing guard in angular 6
angular 6 auth guard
angular 6 canactivate
angular 6 login example
angular 6 registration form example
Angular Login , logout , signup, sign in example tutorial
Angular 6 tutorial login form
Angular 6 tutorial logout
angular 6 tutorial sign
angular 6 signup
shopping cart login form in angular 6
shopping cart logout example in angular 6
shopping cart token based authentication
web api token based authentication
restful api token based authentication
securing web api using token based authentication
authorization in web api using c#
C# web api token based authentication
web api authentication and authorization with angular 6

Angular 5 Login and Logout with Web API Using Token Based Authentication
Design Login Form in Angular 6 application.
Web API Token Based Authentication using OWIN and ASP.Net Identity.

I included it to demonstrate accessing a secure api endpoint with the http authorization header set after logging in to the application, the auth header is set with a access token using web api and OWIN middle ware.
how to get token from web api in angular 6
validate token in angular 6 with web api.
restrict user if they are not loggedin.
log out functionality example in angular 6.
Angular 6 login, validating the user name and password and saving the token and using auth gaurd to protect the route where user is not allowed to go.

How I have achieved everything is:
Created a reactive login form
Created login button click event
Created authentication service
Created a method in authentication service to validate the user
Validate user method will return the token
Once token comes we are storing in local storage
created a auth guard
created can activate method
checking authentication in can activate method
Passing the token to web api for authenticated request
How to claims in web api