Rystem.Authentication.Social 9.1.2

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

What is Rystem?

Rystem.Authentication.Social

This project would be a super project to help the api creator to have fast api behind business interfaces and services dispatched through dependency injection.

How to use it

You need to configure the social information and token settings, for instance the duration of your token.

builder.Services.AddSocialLogin(x =>
{
    x.Google.ClientId = builder.Configuration["SocialLogin:Google:ClientId"];
    x.Google.ClientSecret = builder.Configuration["SocialLogin:Google:ClientSecret"];
    x.Google.RedirectDomain = builder.Configuration["SocialLogin:Google:RedirectDomain"];
    x.Microsoft.ClientId = builder.Configuration["SocialLogin:Microsoft:ClientId"];
    x.Microsoft.ClientSecret = builder.Configuration["SocialLogin:Microsoft:ClientSecret"];
    x.Microsoft.RedirectDomain = builder.Configuration["SocialLogin:Microsoft:RedirectDomain"];
    x.Facebook.ClientId = builder.Configuration["SocialLogin:Facebook:ClientId"];
    x.Facebook.ClientSecret = builder.Configuration["SocialLogin:Facebook:ClientSecret"];
    x.Facebook.RedirectDomain = builder.Configuration["SocialLogin:Facebook:RedirectDomain"];
},
x =>
{
    x.BearerTokenExpiration = TimeSpan.FromHours(1);
    x.RefreshTokenExpiration = TimeSpan.FromDays(10);
});

You need to add in the app builder section the endpoints

app.UseSocialLoginEndpoints();

You can add your provider for user

builder.Services.AddSocialUserProvider<SocialUserProvider>();

SocialUserProvider is a ISocialUserProvider, to call for instance a database or storage to fetch the information about the user with social username/email.

internal sealed class SocialUserProvider : ISocialUserProvider
{
    public Task<SocialUser> GetAsync(string username, IEnumerable<Claim> claims, CancellationToken cancellationToken)
    {
        return Task.FromResult(new SuperSocialUser
        {
            Username = $"a {username}",
            Email = username
        } as SocialUser);
    }

    public async IAsyncEnumerable<Claim> GetClaimsAsync(string? username, CancellationToken cancellationToken)
    {
        await Task.CompletedTask;
        yield return new Claim(ClaimTypes.Name, username!);
        yield return new Claim(ClaimTypes.Upn, "something");
    }
}

public sealed class SuperSocialUser : SocialUser
{
    public string Email { get; set; }
}
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
9.1.2 393,256 5/29/2025
9.1.1 97,764 5/2/2025
9.0.33 163 4/30/2025
9.0.32 186,642 4/15/2025
9.0.31 5,784 4/2/2025
9.0.30 88,778 3/26/2025
9.0.29 8,954 3/18/2025
9.0.28 166 3/17/2025
9.0.27 171 3/16/2025
9.0.26 195 3/13/2025
9.0.25 52,082 3/9/2025
9.0.21 307 3/6/2025
9.0.20 19,510 3/6/2025
9.0.19 239 3/6/2025
9.0.18 235 3/4/2025
9.0.17 134 3/1/2025
9.0.16 119 3/1/2025
9.0.15 75,450 2/22/2025
9.0.14 22,504 2/18/2025
9.0.13 143 2/9/2025
9.0.12 217,645 1/13/2025
9.0.11 23,977 1/9/2025
9.0.10 96 1/9/2025
9.0.9 3,975 1/7/2025
9.0.8 12,466 1/6/2025
9.0.7 132 1/6/2025
9.0.4 92,252 12/23/2024
9.0.3 129 12/22/2024
9.0.2 10,679 12/21/2024
9.0.1 1,169 12/21/2024
9.0.0 173,054 11/16/2024
9.0.0-rc.1 97 10/18/2024
6.2.0 219,070 10/9/2024
6.1.1 146 10/9/2024
6.1.0 47,950 9/29/2024
6.0.24 183 9/11/2024
6.0.23 340,048 7/18/2024
6.0.21 164 6/18/2024
6.0.20 727,804 6/16/2024
6.0.19 30,398 6/14/2024
6.0.18 140 6/14/2024
6.0.17 152 6/14/2024
6.0.16 50,021 6/10/2024
6.0.15 150 6/9/2024
6.0.14 94,290 5/24/2024
6.0.13 158 5/23/2024
6.0.12 133 5/23/2024
6.0.11 159 5/20/2024
6.0.9 173 5/20/2024
6.0.7 163 5/18/2024
6.0.6 155 5/10/2024
6.0.5 130 5/10/2024
6.0.4 549,764 4/3/2024
6.0.3 198 3/25/2024
6.0.2 198 3/11/2024
6.0.1 211 3/8/2024
6.0.0 530 11/21/2023
6.0.0-rc.6 97 11/9/2023