6

What is the best way to have a username and password authentication system that works between Angular 2 and .NET Web API?

2 Answers 2

8

First of all try to avoid using self implemented methods. Most commonly used approach is to use Json web token. https://jwt.io/ There for when you log in, return Token to angular2 and then pass it on every request. There are many examples of implementation and libraries to be used. https://github.com/auth0/angular2-jwt

How to use JWT in MVC application for authentication and authorization?

Sign up to request clarification or add additional context in comments.

Comments

1

Best way is using a package called IdentityServer. I have written a tutorial on it but using one of its older versions, however it will give you a good idea:

Securing .Net Core Web API with IdentityServer4 (Resource Owner flow); using SQL Server db, enabling refresh tokens and external login - Part 1

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.