Nedo.AspNet.Authentication.Facebook 2.0.9

dotnet add package Nedo.AspNet.Authentication.Facebook --version 2.0.9
                    
NuGet\Install-Package Nedo.AspNet.Authentication.Facebook -Version 2.0.9
                    
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.Facebook" Version="2.0.9" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Nedo.AspNet.Authentication.Facebook" Version="2.0.9" />
                    
Directory.Packages.props
<PackageReference Include="Nedo.AspNet.Authentication.Facebook" />
                    
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.Facebook --version 2.0.9
                    
#r "nuget: Nedo.AspNet.Authentication.Facebook, 2.0.9"
                    
#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.Facebook@2.0.9
                    
#: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.Facebook&version=2.0.9
                    
Install as a Cake Addin
#tool nuget:?package=Nedo.AspNet.Authentication.Facebook&version=2.0.9
                    
Install as a Cake Tool

Nedo.AspNet.Authentication.Facebook

"Sign in with Facebook" — your app mints its own JWTs after verifying a Facebook access token via the Graph API. The SPA uses the Facebook JS SDK to obtain the access token and POSTs it to your API.

Install

dotnet add package Nedo.AspNet.Authentication.Facebook

Quickstart

using Nedo.AspNet.Authentication.Facebook;

builder.Services.AddFacebook(opts =>
{
    opts.AppId     = builder.Configuration["Facebook:AppId"]!;
    opts.AppSecret = builder.Configuration["Facebook:AppSecret"]!;   // used for app-secret-proof
});

var app = builder.Build();
app.MapLocalAuth();
app.MapLocalAccount();
app.MapFacebookAuth();   // POST /auth/facebook { accessToken, intent? }

Frontend (SPA)

<script async defer crossorigin="anonymous" src="https://connect.facebook.net/en_US/sdk.js"></script>
FB.init({ appId: import.meta.env.VITE_FACEBOOK_APP_ID, version: 'v18.0' });

FB.login(async (response) => {
  if (response.status !== 'connected') return;

  const tokens = await fetch('/auth/facebook', {
    method: 'POST',
    headers: { 'content-type': 'application/json' },
    body: JSON.stringify({ accessToken: response.authResponse.accessToken, intent: 'signin' }),
  }).then(r => r.json());
}, { scope: 'email' });

App-secret-proof

The backend computes appsecret_proof = HMAC-SHA256(accessToken, AppSecret) and includes it on the me Graph API call. This is Facebook's recommended hardening against access-token theft — even an attacker who steals the token can't query the Graph API without the secret.

Console setup

  1. https://developers.facebook.com/apps/Create AppConsumer.
  2. Add the Facebook Login product → Settings → add your SPA origin to Valid OAuth Redirect URIs (even though the JS SDK handles redirects; Facebook still validates the origin).
  3. App Settings → Basic → copy App ID + App Secret.

Full walkthrough: docs/providers/social/facebook.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 121 5/11/2026
2.0.8 100 5/6/2026
2.0.7 100 5/5/2026
2.0.6 95 5/5/2026
2.0.4 96 5/4/2026
2.0.3 97 5/4/2026
2.0.2 108 5/2/2026
2.0.1 103 5/2/2026
2.0.0 104 5/1/2026