Nedo.AspNet.Authentication.Apple
2.0.7
See the version list below for details.
dotnet add package Nedo.AspNet.Authentication.Apple --version 2.0.7
NuGet\Install-Package Nedo.AspNet.Authentication.Apple -Version 2.0.7
<PackageReference Include="Nedo.AspNet.Authentication.Apple" Version="2.0.7" />
<PackageVersion Include="Nedo.AspNet.Authentication.Apple" Version="2.0.7" />
<PackageReference Include="Nedo.AspNet.Authentication.Apple" />
paket add Nedo.AspNet.Authentication.Apple --version 2.0.7
#r "nuget: Nedo.AspNet.Authentication.Apple, 2.0.7"
#:package Nedo.AspNet.Authentication.Apple@2.0.7
#addin nuget:?package=Nedo.AspNet.Authentication.Apple&version=2.0.7
#tool nuget:?package=Nedo.AspNet.Authentication.Apple&version=2.0.7
Nedo.AspNet.Authentication.Apple
"Sign in with Apple" — your app mints its own JWTs after verifying an Apple-issued ID token from the Apple JS SDK on the SPA side.
Install
dotnet add package Nedo.AspNet.Authentication.Apple
Quickstart
using Nedo.AspNet.Authentication.Apple;
builder.Services.AddApple(opts =>
{
opts.ServiceId = builder.Configuration["Apple:ServiceId"]!; // e.g. "com.example.app.web"
});
var app = builder.Build();
app.MapLocalAuth();
app.MapLocalAccount();
app.MapAppleAuth(); // POST /auth/apple { idToken, user?, intent? }
Frontend (SPA)
Apple's JS SDK gives you the ID token + (only on first sign-in) the user's name:
<script type="text/javascript" src="https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js"></script>
AppleID.auth.init({
clientId: import.meta.env.VITE_APPLE_SERVICE_ID,
redirectURI: window.location.origin,
scope: 'name email',
usePopup: true,
});
const data = await AppleID.auth.signIn();
const tokens = await fetch('/auth/apple', {
method: 'POST',
headers: { 'content-type': 'application/json' },
body: JSON.stringify({
idToken: data.authorization.id_token,
user: data.user ? JSON.stringify(data.user) : undefined, // only present on first sign-in
intent: 'signin',
}),
}).then(r => r.json());
The first-sign-in name quirk
Apple sends the user's name (firstName, lastName) only on the very first authorization. If your backend wasn't ready or you didn't capture it, you'll never see it again — Apple's privacy posture. The endpoint stores it on the local user when present, so subsequent sign-ins still have a display name.
Console setup
- https://developer.apple.com/account/resources/identifiers/list → register an App ID with Sign In with Apple capability.
- Register a Services ID (e.g.
com.example.app.web) — this is yourServiceIdconfig value. - Configure the Services ID with your domain + return URL.
- Generate a .p8 private key with Sign In with Apple access (server-side flows only — the SPA-side ID-token-exchange flow this package uses doesn't need the private key).
Full walkthrough: docs/providers/social/apple.md.
License
MIT — see LICENSE.
| Product | Versions 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. |
-
net9.0
- Nedo.AspNet.Authentication (>= 2.0.7)
- Nedo.AspNet.Authentication.Local (>= 2.0.7)
- Nedo.AspNet.Authentication.Oidc (>= 2.0.7)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.