Skip to content

Web API Template

Jean-Marc Prieur edited this page Aug 6, 2020 · 33 revisions

The following animated image shows how you can build the NuGet package containing the project templates for .NET Core, install them locally, and create a new Web API. It also shows the important part of the code. You can open the image in a new tab if you want to get a full resolution image.

Microsoft Identity Web-2

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

You can download the Microsoft.Identity.Web.ProjectTemplates-0.2.1-preview NuGet package from NuGet.org

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

cd ProjectTemplates
dotnet pack

Install the templates in dotnet core

cd bin
cd Debug
dotnet new -i Microsoft.Identity.Web.ProjectTemplates::0.2.1-preview

or

cd bin
cd Debug
dotnet new -i Microsoft.Identity.Web.ProjectTemplates.0.2.1-preview.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