Skip to content

Samples

Doğan Erişen edited this page Feb 18, 2021 · 28 revisions

Dev Samples

These samples showcase the most up-to-date usage of MSAL.js, while lacking detailed walkthroughs that might be necessary for new users. To review them, please refer to the /samples directory.

Featured Samples

Samples here provide a more friendly introduction for setup and running, as well as explanation about how the code works.

Sample Features Level Description

ms-identity-node | msal-node| Basic | Node.js & Express web application authenticating users against Azure AD. javascript-nodejs-desktop | msal-node| Basic | Electron desktop application authenticating users against Azure AD and calling Microsoft Graph. javascript-nodejs-console | msal-node| Basic | Node.js console daemon application using client-credentials flow to call Microsoft Graph. javascript-graphapi-v2 | msal-core | Basic | VanillaJS single-page application calling the Microsoft Graph using msal.js (Azure AD V2 endpoint). javascript-v2 | msal-browser | Basic | VanillaJS single-page application using MSAL.js v2.x and OAuth 2.0 Authorization Code Flow with PKCE on Microsoft identity platform. b2c-javascript-msal-singlepageapp| msal-core | Basic | B2C single-page application calling a web API protected by Azure AD B2C. b2c-javascript-spa| msal-browser | Basic | B2C single-page application calling a web API using the OAuth 2.0 Authorization Code Flow with PKCE. javascript-singlepageapp-angular| msal-angular | Basic | Angular single-page application demonstrating how to login, logout, protect a route, and acquire an access token for a protected resource such as Microsoft Graph. javascript-angular-spa| msal-angular-v2 | Basic | Angular single-page application demonstrating how to login, logout, protect a route, and acquire an access token for a protected resource such as Microsoft Graph. b2c-javascript-angular-spa| msal-angular | Basic | B2C Angular single-page application calling a web API protected by Azure AD B2C. javascript-react-spa| msal-react | Basic | React single-page application demonstrating how to login, logout, protect a route, and acquire an access token for a protected resource such as Microsoft Graph. javascript-angular-spa-aspnetcore-webapi| msal-angular | Intermediate | Angular single-page application which authenticates users with Azure AD and calls a protected ASP.NET Core web API. javascript-react-spa-dotnetcore-webapi-obo| msal-core | Intermediate | React single-page application which authorizes an ASP.NET Core web API to call MS Graph API on its behalf. ms-identity-javascript-angular-spa-dotnetcore-webapi-roles-groups| msal-angular | Advanced | Angular Single-Page Application (SPA) calling .NET Core Web API using App Roles and Security Groups for Implementing Role-Based Access Control (RBAC). ms-identity-javascript-angular-spa-aspnet-webapi-multitenant| msal-angular | Advanced | Multi-tenancy tutorial demonstrating how to expose your app to users from other tenants, provide consent as admin and deploy it on Azure App Services. ms-identity-javascript-tutorial| msal-browser | Comprehensive | A chapterwise tutorial that will take you through the fundamentals of authentication with Microsoft identity platform in Vanilla JavaScript.

Other Featured Samples

For a full list MSAL code samples targeting JavaScript, .NET, Java, Python, Node, iOS, Android and other platforms, please refer to Microsoft identity platform code samples.