when we were doing the .net 6 Azure ad integration we had some hard time this is the recommended library If you are developing a web app that needs to authenticate users with Azure Active Directory B2C (Azure AD B2C), you should check out the Microsoft.AspNetCore.Authentication.JwtBearer and Microsoft.AspNetCore.Authentication.OpenIdConnect packages. These packages enable your web app to use the JSON Web Token (JWT) bearer authentication handler and the OpenID Connect protocol middleware, which are compatible with Azure AD B2C. With these packages, you can easily configure your web app to sign in users using various identity providers, such as social accounts or enterprise accounts, and protect your web API with Azure AD B2C tokens. These packages are part of the ASP.NET Core framework and support .NET 5.0 or later.