ASP.NET Core Web API Introduction
Download a sample project.
This Quickstart will guide you through the various tasks related to using Auth0-issued JSON Web Tokens to secure your ASP.NET Core Web API.
Seed & Samples
If you would like to follow along with this Quickstart you can download the seed project. The seed project is just a basic ASP.NET Web API with a simple controller and some of the NuGet packages which will be needed included. It also contains an
appSettings.json file where you can configure the various Auth0-related settings for your application.
The final project after each of the steps is also available in the Sample repository. You can find the final result for each step in the relevant folder inside the repository.
Create an Application
Create an Auth0 account (or login) and add an authentication client instance from the dashboard. Once you create your client, you will be provided with credentials (Domain, Client ID, and Client Secret) which should be stored somewhere safe (do not commit this information to your git repo!). You can download the sample after you login and it will be pre-configured with your Default App credentials.
Be sure to update the
appsettings.json file in the seed project with the correct values for your application.
To use Auth0 JSON Web Tokens with ASP.NET Core you will use the JWT Middleware. Add the
Microsoft.AspNetCore.Authentication.Jwt package to your application.
This was already done for you in the seed project, so no need to add it if you are using the seed project as a starting point.
That's all you need to start working with Auth0 in your Web API!
Please continue with the Authentication tutorial to secure your Web API.