Posts

Showing posts from July, 2017

Secured Token Based WebAPI with custom authentication

Image
Hi Guys, I had a requirement to create Secured  Token Based WebAPI which can be consumed using mobile applications. And it had to check a custom authentication stored in database. Upon successful login an auth token would be returned subsequent requests must pass this auth token to get data. Reference : http://bitoftech.net/2014/06/01/token-based-authentication-asp-net-web-api-2-owin-asp-net-identity/ 1) Create a WebAPI Project as following 2) Modify the Startup.cs as following using Microsoft.Owin; using Microsoft.Owin.Security.OAuth; using Owin; using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Http; [assembly: OwinStartup(typeof(SecuredWebAPI.Startup))] namespace SecuredWebAPI {     public class Startup     {         public static OAuthAuthorizationServerOptions OAuthOptions { get; private set; }         public sta...