All Projects → Azure-Samples → ms-identity-javascript-react-tutorial

Azure-Samples / ms-identity-javascript-react-tutorial

Licence: MIT License
A chapterwise tutorial that will take you through the fundamentals of modern authentication with Microsoft identity platform in React using MSAL React

Programming Languages

javascript
184084 projects - #8 most used programming language
powershell
5483 projects
HTML
75241 projects
EJS
674 projects
CSS
56736 projects
shell
77523 projects

Projects that are alternatives of or similar to ms-identity-javascript-react-tutorial

ms-identity-javascript-tutorial
A chapterwise tutorial that will take you through the fundamentals of modern authentication with Microsoft identity platform in Vanilla JavaScript.
Stars: ✭ 100 (+0%)
Mutual labels:  azure-active-directory, msal, ms-graph, microsoft-identity-platform, msal-js
ms-identity-javascript-angular-spa-aspnet-webapi-multitenant
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 using MSAL Angular
Stars: ✭ 18 (-82%)
Mutual labels:  azure-active-directory, microsoft-identity-platform, msal-js
ms-identity-mobile-apple-swift-objc
An iOS sample in Swift that authenticates Microsoft Account and Azure AD users and calls the Graph API using OAuth 2.0
Stars: ✭ 61 (-39%)
Mutual labels:  identity, azure-active-directory, msal
ms-identity-javascript-react-spa-dotnetcore-webapi-obo
A React & Redux single-page application that authorizes an ASP.NET Core web API to call MS Graph API on-behalf-of a signed-in user.
Stars: ✭ 62 (-38%)
Mutual labels:  ms-graph, microsoft-identity-platform, msal-js
Hydra
OpenID Certified™ OpenID Connect and OAuth Provider written in Go - cloud native, security-first, open source API security for your infrastructure. SDKs for any language. Compatible with MITREid.
Stars: ✭ 11,884 (+11784%)
Mutual labels:  identity, oauth2
AzureADAuthRazorUiServiceApiCertificate
Azure AD flows using ASP.NET Core and Microsoft.Identity
Stars: ✭ 41 (-59%)
Mutual labels:  oauth2, microsoft-identity-platform
Authing
🔥Authing - IDaaS/IAM solution that can Auth to web and mobile applications.
Stars: ✭ 247 (+147%)
Mutual labels:  identity, oauth2
Aspnetcoreid4external
external OpenID Connect Login to IdentityServer4 with AAD
Stars: ✭ 63 (-37%)
Mutual labels:  identity, oauth2
My-Azure-AD-B2C-use-cases
Recopilation of Azure AD B2C use cases I use to find in customers, or are requested by peers
Stars: ✭ 23 (-77%)
Mutual labels:  identity, b2c
active-directory-android
An android app that uses Azure AD and the ADAL library for authenticating the user and calling a web API using OAuth 2.0 access tokens.
Stars: ✭ 33 (-67%)
Mutual labels:  identity, azure-active-directory
react-native-msal
MSAL for React Native
Stars: ✭ 62 (-38%)
Mutual labels:  azure-active-directory, msal
Identitybase
IdentityBase is a Universal Identity Platform for web, mobile and IoT built on top of IdentityServer.
Stars: ✭ 112 (+12%)
Mutual labels:  identity, oauth2
Zitadel
ZITADEL - Cloud Native Identity and Access Management
Stars: ✭ 105 (+5%)
Mutual labels:  identity, oauth2
Oauthlib
A generic, spec-compliant, thorough implementation of the OAuth request-signing logic
Stars: ✭ 2,323 (+2223%)
Mutual labels:  identity, oauth2
Cierge
🗝️ Passwordless OIDC authentication done right
Stars: ✭ 1,245 (+1145%)
Mutual labels:  identity, oauth2
active-directory-b2c-javascript-hellojs-singlepageapp
A single page app, implemented with an ASP.NET Web API backend, that signs up & signs in users using Azure AD B2C and calls the web API using OAuth 2.0 access tokens.
Stars: ✭ 63 (-37%)
Mutual labels:  identity, azure-active-directory
logto
🧑‍🚀 Logto helps you build the sign-in, auth, and user identity within minutes. We provide an OIDC-based identity service and the end-user experience with username, phone number, email, and social sign-in, with extendable multi-language support.
Stars: ✭ 3,421 (+3321%)
Mutual labels:  identity, oauth2
Jpproject.identityserver4.adminui
🔧 ASP.NET Core 3 & Angular 8 Administration Panel for 💞IdentityServer4 and ASP.NET Core Identity
Stars: ✭ 717 (+617%)
Mutual labels:  identity, oauth2
Identityserver4
OpenID Connect and OAuth 2.0 Framework for ASP.NET Core
Stars: ✭ 8,428 (+8328%)
Mutual labels:  identity, oauth2
ms-identity-javascript-angular-spa-aspnetcore-webapi
An Angular single-page application that authenticates users with Azure AD and calls a protected ASP.NET Core web API using MSAL Angular
Stars: ✭ 72 (-28%)
Mutual labels:  microsoft-identity-platform, msal-js
page_type languages products description urlFragment
sample
javascript
msal-react
ms-graph
azure-storage
azure-app-service
azure-functions
azure-resource-manager
azure-app-service-static
azure-active-directory
azure-active-directory-b2c
Tutorial: Enable your React single-page application to sign-in users, call the Graph API and deploy on Azure
ms-identity-javascript-react-tutorial

Tutorial: Enable your React single-page application to sign-in users and call APIs with the Microsoft identity platform

Build Code Scan GitHub issues npm npm GitHub

The Microsoft identity platform, along with Azure Active Directory (Azure AD) and Azure Azure Active Directory B2C (Azure AD B2C) are central to the Azure cloud ecosystem. This tutorial aims to take you through the fundamentals of modern authentication with React, using the Microsoft Authentication Library for React (MSAL React).

We recommend following the chapters in successive order. However, the code samples are self-contained, so feel free to pick samples by topics that you may need at the moment.

⚠️ This is a work in progress. Come back frequently to discover more samples.

ℹ️ Samples in this tutorial use functional React components. If you want to use MSAL React with class-based React components, see: Docs: Class Components

Prerequisites

Please refer to each sample's README for sample-specific prerequisites.

Recommendations

Please refer to each sample's README for sample-specific recommendations.

Contents

  • For Azure AD, start the tutorial from here
  • For Azure AD B2C, start the tutorial from here

Alternatively, choose below the sample you want to review.

Chapter 1: Sign-in a user to your application

Sign-in with Azure AD
Sign-in your users with the Azure AD and learn to work with ID Tokens. Learn how single sign-on (SSO) works. Learn to secure your apps to operate in national clouds.
Sign-in with Azure AD B2C
Sign-in your customers with Azure AD B2C. Learn to integrate with external social identity providers. Learn how to use user-flows and custom policies.

Chapter 2: Sign-in a user and get an Access Token for Microsoft Graph

Get an Access Token from Azure AD and call Microsoft Graph
Authenticate your users and acquire an Access Token for Microsoft Graph and then call the Microsoft Graph API.

Chapter 3: Protect an API and call the API from your client app

Protect and call a web API on Azure AD
Protect your web API with the Azure AD. Use a client application to sign-in a user, acquire an Access Token for your web API and call your protected web API.
Protect and call a web API on Azure AD B2C
Protect your web API with Azure AD B2C. Use a client application to sign-in a user, acquire an Access Token for your web API and call your protected web API.

Chapter 4: Deploy your application to Azure

Deploy to Azure Storage and App Service
Prepare your SPA for deployment to Azure storage and your API to App Service. Learn how to package and upload your files. Learn how to configure authentication parameters and use Azure services for managing your operations.
Deploy to Azure Static Web Apps
Prepare your app for deployment to Azure Static Web Apps. Learn how to protect and call an Azure Function API. Learn how to configure authentication parameters and use Azure services for managing your operations.

Chapter 5: Control access to your protected API using App Roles and Security Groups

Use App Roles for access control
Define App Roles and use roles claim in a token to implement Role-based Access Control (RBAC) for your SPA and protected web API.
Use Security Groups for access control
Create Security Groups and use groups claim in a token to implement Role-based Access Control (RBAC) for your SPA and protected web API. Handle overage scenarios.

Chapter 6: Dive into advanced scenarios

Call a web API that calls Microsoft Graph on behalf of a user
Enhance your protected web API to acquire an Access Token for Microsoft Graph on-behalf-of a user signed-in to the client app. Enable Conditional Access for your downstream API and handle MFA requirement.
Call a web API using Proof of Possession tokens
Acquire proof of possession (PoP) tokens. Learn how to prevent token replay attacks with PoP authentication scheme. Learn how to validate PoP tokens.
Use Conditional Access Authentication Context
Enable conditional access for your web API. Use auth context to implement granular access control to resources. Handle claims challenge in client applications.

We'd love your feedback!

Were we successful in addressing your learning objective? Consider taking a moment to share your experience with us.

More information

Learn more about the Microsoft identity platform:

See more code samples:

Community Help and Support

Use Stack Overflow to get support from the community. Ask your questions on Stack Overflow first and browse existing issues to see if someone has asked your question before. Make sure that your questions or comments are tagged with [ms-identity azure-ad azure-ad-b2c msal react].

If you find a bug in the sample, please raise the issue on GitHub Issues.

To provide a recommendation, visit the following User Voice page.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit cla.opensource.microsoft.com.

Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].