Rystem.Authentication.Social
10.0.7
dotnet add package Rystem.Authentication.Social --version 10.0.7
NuGet\Install-Package Rystem.Authentication.Social -Version 10.0.7
<PackageReference Include="Rystem.Authentication.Social" Version="10.0.7" />
<PackageVersion Include="Rystem.Authentication.Social" Version="10.0.7" />
<PackageReference Include="Rystem.Authentication.Social" />
paket add Rystem.Authentication.Social --version 10.0.7
#r "nuget: Rystem.Authentication.Social, 10.0.7"
#:package Rystem.Authentication.Social@10.0.7
#addin nuget:?package=Rystem.Authentication.Social&version=10.0.7
#tool nuget:?package=Rystem.Authentication.Social&version=10.0.7
Rystem.Authentication.Social
Rystem.Authentication.Social is the server-side social-login package in the Authentication area.
It is not a full identity platform. Its job is narrower:
- accept provider-specific codes or access tokens from a client
- validate or exchange them through a provider-specific
ITokenChecker - issue ASP.NET Core bearer tokens
- expose a small authenticated
/Userendpoint
Installation
dotnet add package Rystem.Authentication.Social
Architecture
The server package revolves around two entry points:
AddSocialLogin<TProvider>(...)UseSocialLoginEndpoints()
The high-level flow is:
- configure one or more providers in
SocialLoginBuilder - implement
ISocialUserProviderfor app-specific claims and user payloads - call
AddSocialLogin<TProvider>(...) - call
UseSocialLoginEndpoints() - let a Blazor or TypeScript client complete the browser-side OAuth flow and call the token endpoint
The package then issues standard ASP.NET bearer tokens through Results.SignIn(...).
Registration
The real public registration method is:
builder.Services.AddSocialLogin<MySocialUserProvider>(settings =>
{
settings.Google.ClientId = builder.Configuration["SocialLogin:Google:ClientId"];
settings.Google.ClientSecret = builder.Configuration["SocialLogin:Google:ClientSecret"];
settings.Google.AddUris("https://localhost:7100", "https://app.example.com");
settings.Microsoft.ClientId = builder.Configuration["SocialLogin:Microsoft:ClientId"];
settings.Microsoft.ClientSecret = builder.Configuration["SocialLogin:Microsoft:ClientSecret"];
settings.Microsoft.AddUris("https://localhost:7100", "https://app.example.com");
settings.GitHub.ClientId = builder.Configuration["SocialLogin:GitHub:ClientId"];
settings.GitHub.ClientSecret = builder.Configuration["SocialLogin:GitHub:ClientSecret"];
}, bearer =>
{
bearer.BearerTokenExpiration = TimeSpan.FromHours(1);
bearer.RefreshTokenExpiration = TimeSpan.FromDays(10);
});
Signature:
IServiceCollection AddSocialLogin<TProvider>(
Action<SocialLoginBuilder> settings,
Action<BearerTokenOptions>? action = null,
ServiceLifetime userProviderLifeTime = ServiceLifetime.Transient)
where TProvider : class, ISocialUserProvider
What it registers:
- ASP.NET bearer-token authentication
ISocialUserProvider- one named
ITokenCheckerper provider, plus the internalDotNetchecker for refresh-token reuse - named
HttpClients only for providers whose configuration is active
Provider configuration model
SocialLoginBuilder currently exposes these providers:
GoogleMicrosoftFacebookGitHubAmazonLinkedinXInstagramPinterestTikTok
The activation rules depend on the settings type:
| Settings type | Used by | Active when |
|---|---|---|
SocialDefaultLoginSettings |
Facebook, Amazon | always true |
SocialLoginSettings |
base type | ClientId != null |
SocialLoginWithSecretsSettings |
GitHub | ClientId and ClientSecret are set |
SocialLoginWithSecretsAndRedirectSettings |
Google, Microsoft, Linkedin, X, Instagram, Pinterest, TikTok | client id, client secret, and at least one allowed URI are set |
For redirect-based providers, add allowed origins with:
settings.Google.AddUri("https://app.example.com");
settings.Google.AddUris("https://app.example.com", "https://staging.example.com");
settings.Google.AddDomainWithProtocolAndPort("localhost", "https", 7100);
Important detail: allowed redirects are matched by scheme, host, and port. The stored path is not used as a differentiator when validating the incoming domain.
ISocialUserProvider
ISocialUserProvider is the application extension point.
public interface ISocialUserProvider
{
Task<ISocialUser> GetAsync(string username, IEnumerable<Claim> claims, CancellationToken cancellationToken);
IAsyncEnumerable<Claim> GetClaimsAsync(TokenResponse response, CancellationToken cancellationToken);
}
Responsibilities:
GetClaimsAsync(...)controls which claims are embedded into the issued bearer tokenGetAsync(...)controls what/api/Authentication/Social/Userreturns
The sample provider in src/Authentication/Tests/Rystem.Authentication.Social.TestApi/Services/SocialUserProvider.cs shows both:
- adding
ClaimTypes.Name - adding a custom language claim with
RystemClaimTypes.Language - returning a richer app user model that implements
ISocialUser
Endpoints
Expose the runtime endpoints with:
app.UseSocialLoginEndpoints();
This method does more than mapping endpoints: it also calls UseAuthentication() and UseAuthorization() internally.
api/Authentication/Social/Token
This endpoint is mapped with Map(...), so it accepts any verb. In practice the bundled clients use:
GETfor simple exchangesPOSTwhen they need to send extra body parameters such ascode_verifier
Inputs:
| Name | Source | Meaning |
|---|---|---|
provider |
query | ProviderType value |
code |
query | authorization code, provider access token, or refresh token depending on provider |
redirectPath |
query | optional redirect path from the client |
additionalParameters |
JSON body | optional provider-specific extras like PKCE code_verifier |
Behavior:
- reads
Originfirst, thenReferer - derives a domain from those headers
- builds a
TokenCheckerSettingsobject withDomain,RedirectPath, andAdditionalParameters - resolves the provider-specific named
ITokenChecker - on success builds a
ClaimsPrincipaland returnsResults.SignIn(...)
The actual wire payload is the ASP.NET bearer-token sign-in response, not a custom social-auth DTO.
api/Authentication/Social/User
This endpoint requires authorization and returns either:
ISocialUserProvider.GetAsync(...)output, when a provider is registered- or
ISocialUser.OnlyUsername(...)when no provider is available
Refresh flow and the DotNet provider
ProviderType.DotNet is the package's internal refresh path, not a social provider.
It validates a refresh token previously issued by ASP.NET bearer auth and only accepts it when the original token domain matches the current request domain claim.
Important caveats
Origin or Referer is effectively required
The token endpoint refuses to proceed when it cannot infer a non-empty domain from Origin or Referer, even for providers that do not use redirect whitelists in their settings object.
Redirect behavior is provider-specific
The overall contract supports redirectPath, but provider implementations are not fully uniform. Some use the computed redirect URI, while others rely on harder-coded callback shapes.
Allowed URI validation is host-oriented
For redirect-whitelist providers, matching is based on scheme, host, and port. Multiple callback paths on the same host are not distinguished during domain validation.
This package issues bearer tokens; it does not define your user model
Your claims and /User payload come from ISocialUserProvider. Without it, the package falls back to a username-only response.
Grounded by sample files
src/Authentication/Tests/Rystem.Authentication.Social.TestApi/Program.cssrc/Authentication/Tests/Rystem.Authentication.Social.TestApi/Services/SocialUserProvider.cssrc/Authentication/Rystem.Authentication.Social/Extensions/ServiceCollectionExtensions.cssrc/Authentication/Rystem.Authentication.Social/Extensions/EndpointRouteBuilderExtensions.cs
Use this package when you want a small ASP.NET Core token-exchange backend for social-login clients, not a full end-to-end identity platform.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. 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. |
-
net10.0
- Google.Apis.Auth (>= 1.73.0)
- Microsoft.IdentityModel.Protocols.OpenIdConnect (>= 8.17.0)
- Microsoft.IdentityModel.Tokens (>= 8.17.0)
- Rystem.Authentication.Social.Abstractions (>= 10.0.7)
- Rystem.DependencyInjection (>= 10.0.7)
- System.IdentityModel.Tokens.Jwt (>= 8.17.0)
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 |
|---|---|---|
| 10.0.7 | 37 | 3/26/2026 |
| 10.0.6 | 170,546 | 3/3/2026 |
| 10.0.5 | 99 | 2/22/2026 |
| 10.0.4 | 109 | 2/9/2026 |
| 10.0.3 | 147,888 | 1/28/2026 |
| 10.0.1 | 209,075 | 11/12/2025 |
| 9.1.3 | 305 | 9/2/2025 |
| 9.1.2 | 764,477 | 5/29/2025 |
| 9.1.1 | 97,845 | 5/2/2025 |
| 9.0.33 | 251 | 4/30/2025 |
| 9.0.32 | 186,729 | 4/15/2025 |
| 9.0.31 | 5,858 | 4/2/2025 |
| 9.0.30 | 88,852 | 3/26/2025 |
| 9.0.29 | 9,020 | 3/18/2025 |
| 9.0.28 | 237 | 3/17/2025 |
| 9.0.27 | 251 | 3/16/2025 |
| 9.0.26 | 280 | 3/13/2025 |
| 9.0.25 | 52,153 | 3/9/2025 |
| 9.0.21 | 379 | 3/6/2025 |
| 9.0.20 | 19,584 | 3/6/2025 |