O'Reilly logo

ASP.NET Web API Security Essentials by Rajesh Gunasundaram

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 4. Securing Web API Using OAuth2

This chapter explains how to secure a web API using OAuth2 to authenticate against a membership database using OWIN middleware. You will be able to use local logins to send authenticated requests using OAuth2.

In this chapter, we will cover the following topics:

  • Host OWIN in IIS and add Web API to the OWIN pipeline
  • Individual User Account Login authentication flow
  • Send an unauthorized request
  • Get an access token
  • Send an authenticated request

Hosting OWIN in IIS and adding Web API to the OWIN pipeline

Let's create an empty Web API template to integrate ASP.NET Identity. Follow the given steps:

  1. Create New Project from the Start page in Visual Studio.
  2. Select Visual C# Installed Template named Web.
  3. Select ASP.NET Web ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required