Click here to Skip to main content
15,887,405 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,

I know its a very basic question but i got confuse after google it because people implemented in different ways. so my major concern is what's standard way to implement basic authentication in api.

I go through following links:

What I have tried:

Token Based Authentication using ASP.NET Web API 2, Owin, and Identity - Bit of Technology[^]

ASP.NET Identity 2.1 Roles Based Authorization with ASP.NET Web API - Part 4 - Bit of Technology[^]


Basic Authentication in Web API Based on User Role[^]
Posted
Updated 7-Nov-16 20:51pm

1 solution

Hello,

It depends on purpose of your web Api. For example if you exposing Api to public just like Google Adwords and Yahoo Gemini also you dont want to use username/password for each protected resource. Go for Token based authentication.
For general purpose I will suggest you to use Token based.

Quote:
The general concept behind a token-based authentication system is simple. Allow users to enter their username and password in order to obtain a token which allows them to fetch a specific resource - without using their username and password. Once their token has been obtained, the user can offer the token - which offers access to a specific resource for a time period - to the remote site.


Asp.Net Identity is best suited for Organizational Api like Financial applications, Human resource and services. You can protect your API based on Roles and authentication. On each request you have to authenticate your self by username/password etc.
Asp.Net Identity provide you huge verity and support OAuth integration, works with OWIN.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900