Nedo.AspNet.Authentication.Microsoft 2.0.6

There is a newer version of this package available.
See the version list below for details.
dotnet add package Nedo.AspNet.Authentication.Microsoft --version 2.0.6
                    
NuGet\Install-Package Nedo.AspNet.Authentication.Microsoft -Version 2.0.6
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Nedo.AspNet.Authentication.Microsoft" Version="2.0.6" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Nedo.AspNet.Authentication.Microsoft" Version="2.0.6" />
                    
Directory.Packages.props
<PackageReference Include="Nedo.AspNet.Authentication.Microsoft" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Nedo.AspNet.Authentication.Microsoft --version 2.0.6
                    
#r "nuget: Nedo.AspNet.Authentication.Microsoft, 2.0.6"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Nedo.AspNet.Authentication.Microsoft@2.0.6
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Nedo.AspNet.Authentication.Microsoft&version=2.0.6
                    
Install as a Cake Addin
#tool nuget:?package=Nedo.AspNet.Authentication.Microsoft&version=2.0.6
                    
Install as a Cake Tool

Nedo.AspNet.Authentication.Microsoft

"Sign in with Microsoft Account" — your app mints its own JWTs after verifying a Microsoft-issued ID token from MSAL.js on the SPA side. Supports consumer accounts, work accounts, and multi-tenant via the Tenant option.

For Entra ID as the canonical token issuer (resource-server pattern) — i.e. validating Entra-issued JWTs directly without your app re-minting them — use Nedo.AspNet.Authentication.EntraId instead.

Install

dotnet add package Nedo.AspNet.Authentication.Microsoft

Quickstart

using Nedo.AspNet.Authentication.Microsoft;

builder.Services.AddMicrosoft(opts =>
{
    opts.ClientId = builder.Configuration["Microsoft:ClientId"]!;
    opts.Tenant   = builder.Configuration["Microsoft:Tenant"] ?? "consumers";
    // "consumers" — Microsoft personal accounts only
    // "organizations" — work / school accounts only
    // "common" — both, multi-tenant
    // "<tenant-id>" — a specific Entra tenant
});

var app = builder.Build();
app.MapLocalAuth();
app.MapLocalAccount();
app.MapMicrosoftAuth();   // POST /auth/microsoft { idToken, intent? }

Frontend (SPA)

Use @azure/msal-browser:

import { PublicClientApplication } from '@azure/msal-browser';

const msal = new PublicClientApplication({
  auth: {
    clientId: import.meta.env.VITE_MICROSOFT_CLIENT_ID,
    authority: `https://login.microsoftonline.com/${import.meta.env.VITE_MICROSOFT_TENANT}`,
    redirectUri: window.location.origin,
  },
});
await msal.initialize();

const result = await msal.loginPopup({ scopes: ['openid', 'profile', 'email'] });
const tokens = await fetch('/auth/microsoft', {
  method: 'POST',
  headers: { 'content-type': 'application/json' },
  body: JSON.stringify({ idToken: result.idToken, intent: 'signin' }),
}).then(r => r.json());

Sign-in vs sign-up intent

Same as the other social providers — see Google's README for the explanation.

Console setup

  1. https://entra.microsoft.com → Identity → Applications → App registrations → New registration.
  2. Supported account types — pick the audience that matches your Tenant option (consumers ↔ "Personal Microsoft accounts only", common ↔ "Accounts in any organizational directory and personal Microsoft accounts").
  3. Redirect URI — Single-page application — https://app.example.com (and http://localhost:5173 for dev).
  4. Copy the Application (client) ID.

Full walkthrough: docs/providers/social/microsoft.md.

License

MIT — see LICENSE.

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.9 95 5/11/2026
2.0.8 91 5/6/2026
2.0.7 90 5/5/2026
2.0.6 84 5/5/2026
2.0.4 75 5/4/2026
2.0.3 88 5/4/2026
2.0.2 102 5/2/2026
2.0.1 92 5/2/2026
2.0.0 85 5/1/2026