Skip to content

samples

Jean-Marc Prieur edited this page Mar 24, 2023 · 5 revisions

Samples using Microsoft.Identity.Web

Web applications

The following samples illustrate web applications that sign in users. Some samples also demonstrate the application calling Microsoft Graph, or your own web API with the user's identity.

Language/
Platform
Code sample(s)
on GitHub
Auth
libraries
Auth flow
ASP.NET Core
Build
ASP.NET Core Series
Sign in users
Sign in users (B2C)
Call Microsoft Graph
Customize token cache
Call Graph (multi-tenant)
Call Azure REST APIs
Protect web API
Protect web API (B2C)
Protect multi-tenant web API
Use App Roles for access control
Use Security Groups for access control
Deploy to Azure Storage and App Service
• MSAL.NET
• Microsoft.Identity.Web
• OpenID connect
• Authorization code
• On-Behalf-Of
Blazor Server
Build
Blazor Server series
Sign in users
Sign in users (B2C)
Call Microsoft Graph
Call web API
Call web API (B2C)
MSAL.NET Authorization code
ASP.NET Core Use the Conditional Access auth context to perform step-up authentication • MSAL.NET
• Microsoft.Identity.Web
Authorization code

Web API

The following samples show how to protect a web API with the Microsoft identity platform, and how to call a downstream API from the web API.

Language/
Platform
Code sample(s)
on GitHub
Auth
libraries
Auth flow
ASP.NET Call Microsoft Graph MSAL.NET On-Behalf-Of (OBO)
ASP.NET Core Sign in users and call Microsoft Graph MSAL.NET On-Behalf-Of (OBO)

Service / daemon

The following samples show an application that accesses the Microsoft Graph API with its own identity (with no user).

Language/
Platform
Code sample(s)
on GitHub
Auth
libraries
Auth flow
.NET Core Call Microsoft Graph
Call web API
Using managed identity and Azure key vault
MSAL.NET Client credentials grant
ASP.NET Multi-tenant with Microsoft identity platform endpoint MSAL.NET Client credentials grant

Client credentials grant|

Multi-tenant SaaS

The following samples show how to configure your application to accept sign-ins from any Azure Active Directory (Azure AD) tenant. Configuring your application to be multi-tenant means that you can offer a Software as a Service (SaaS) application to many organizations, allowing their users to be able to sign-in to your application after providing consent.

Language/
Platform
Code sample(s)
on GitHub
Auth
libraries
Auth flow
ASP.NET Core ASP.NET Core MVC web application calls Microsoft Graph API MSAL.NET OpenID connect
ASP.NET Core ASP.NET Core MVC web application calls ASP.NET Core web API MSAL.NET Authorization code

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