Auth0 Home Blog Docs

Combining cookie and token authentication in dotnet core 2.0



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: 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:

Does anyone have an example of how to do this?