##Simple Bearer Auth using OWIN Authentication
- Install the following packages:
Microsoft.AspNet.WebApi.Owin
,Microsoft.Owin.Security.OAuth
,Microsoft.Owin.Host.SystemWeb
(for hosting on IIS) - Add the required models and appcontext
- Add helpers
- Add startup.cs
- Create a user account through the db or your own API
- Post the following raw data to
/token
username={username or email}&password={password as plaintext}&grant_type=password
- The response should contain an
access_token
. - Add Header
Authorization = bearer {access_token from previous step}
and make a request to an Authorized controller.
This is a response to this StackOverflow question. This has not meant to scale or be used for anything more than super simple Web API authentication. Comments are welcome!
This may seem exactly what I need: I'm not using asp.net identity, but the old aspnet_membership tables. I want my existing users to be able to login with their username/password (which are stored in my DB) via oAuth...is that what your code does? It serves as its own oAuth authorization server?