Auth0 Home Blog Docs

Combining cookie and token authentication in dotnet core 2.0

dotnet-core

#1

Using ASP.NET Core 2.0. The code is running in a Windows 10 machine (it’s a proof of concept). We need to allow for our .NET Core application to

  1. Authorize access based on either cookie or JWT bearer token
  2. Return either HTML (UI) or JSON (API) responses based on Content Negotiation

There’s an example of doing this in .NET Core version 1 here: https://github.com/auth0-samples/aspnet-core-mvc-plus-webapi but the API for .NET Core 2 has changed significantly and we’ve not been able to adapt the approach. We raised an issue here: https://github.com/auth0-samples/aspnet-core-mvc-plus-webapi/issues/1.

Does anyone have an example of how to do this?