Samples for customer identity and access management (CIAM) in Microsoft Entra External ID

Microsoft maintains code samples that demonstrate how to integrate various application types with Microsoft Entra ID for customers. We provide instructions for downloading and using samples or building your own app based on common authentication and authorization scenarios, development languages, and platforms. Included are instructions for building the project (if applicable) and running the sample application. Within the sample code, comments help you understand how these libraries are used in the application to perform authentication and authorization in a customer tenant.

Samples and guides

Use the tabs to sort samples either by app type or your preferred language/platform.

Single-page application (SPA)

These samples and how-to guides demonstrate how to integrate a single-page application with Microsoft Entra ID for customers.

Language/
Platform
Code sample guide Build and integrate guide
JavaScript, Vanilla Sign in users Sign in users
JavaScript, Angular Sign in users ---
JavaScript, React Sign in users Sign in users

Web app

These samples and how-to guides demonstrate how to write a web application that integrates with Microsoft Entra ID for customers.

Language/
Platform
Code sample guide Build and integrate guide
JavaScript, Node.js (Express) Sign in users
Sign in users and call an API
Sign in users
Sign in users and call an API
ASP.NET Core Sign in users Sign in users

Web API

These samples and how-to guides demonstrate 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 guide Build and integrate guide
ASP.NET Core --- Secure an ASP.NET web API

Browserless

These samples and how-to guides demonstrate how to write a browserless application that integrates with Microsoft Entra ID for customers.

Language/
Platform
Code sample guide Build and integrate guide
JavaScript, Node Sign in users Sign in users
.NET Sign in users Sign in users

Desktop

These samples and how-to guides demonstrate how to write a desktop application that integrates with Microsoft Entra ID for customers.

Language/
Platform
Code sample guide Build and integrate guide
JavaScript, Electron Sign in users ---
ASP.NET (MAUI) Sign in users Sign in users

Mobile

These samples and how-to guides demonstrate how to write a public client mobile application that integrates with Microsoft Entra ID for customers.

Language/
Platform
Code sample guide Build and integrate guide
ASP.NET Core MAUI Sign in users Sign in users

Daemon

These samples and how-to guides demonstrate how to write a daemon application that integrates with Microsoft Entra ID for customers.

Language/
Platform
Code sample guide Build and integrate guide
Node.js Call an API Call an API
.NET Call an API Call an API