Skip to content

Web API Template

Jean-Marc Prieur edited this page Oct 23, 2020 · 33 revisions

Download or build the NuGet package containing the .NET Core template:

You have two ways of installing the templates:

  • either from NuGet
  • or build them from the repository

Option 1: Install the templates in dotnet core

You can download the Microsoft.Identity.Web.ProjectTemplates-1.2.0 NuGet package from NuGet.org. The following command will install the templates from NuGet.org (or anything referenced as .NET sources, for instance in NuGet.config)

dotnet new -i Microsoft.Identity.Web.ProjectTemplates::1.2.0

Option 2: Build and install the templates from the repository

Alternatively if you want to build it yourself clone the Microsoft.Identity.Web repo, and then

dotnet pack /p:ClientSemVer=1.2.0
cd ProjectTemplates
cd bin
cd Debug
dotnet new -i Microsoft.Identity.Web.ProjectTemplates.1.2.0.nupkg

Use the web API template

Microsoft identity platform web API

mkdir webapi
cd webapi
dotnet new webapi2 --auth SingleOrg

Microsoft identity platform web API calling Microsoft Graph

mkdir webapi-graph
cd webapi-graph
dotnet new webapi2 --auth SingleOrg --calls-graph

Microsoft identity platform web API calling a downstream API

mkdir webapi-calls-api
cd webapi-calls-api
dotnet new webapi2 --auth SingleOrg --called-api-url "https://localhost:12345" --called-api-scopes "api://{someguid}/access_as_user"

AzureAD B2C B2C

mkdir webapi-b2c
cd webapi-b2c
dotnet new webapi2 --auth IndividualB2C

(optional) Uninstall the project templates

cd ProjectTemplates
dotnet new -u Microsoft.Identity.Web.ProjectTemplates

Getting started with Microsoft Identity Web

Token cache serialization

Web apps

Web APIs

Daemon scenario

Advanced topics

FAQ

News

Contribute

Other resources

Clone this wiki locally