Rystem.Authentication.Social.Blazor 6.0.14

dotnet add package Rystem.Authentication.Social.Blazor --version 6.0.14
NuGet\Install-Package Rystem.Authentication.Social.Blazor -Version 6.0.14
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.Blazor" Version="6.0.14" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Rystem.Authentication.Social.Blazor --version 6.0.14
#r "nuget: Rystem.Authentication.Social.Blazor, 6.0.14"
#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.
// Install Rystem.Authentication.Social.Blazor as a Cake Addin
#addin nuget:?package=Rystem.Authentication.Social.Blazor&version=6.0.14

// Install Rystem.Authentication.Social.Blazor as a Cake Tool
#tool nuget:?package=Rystem.Authentication.Social.Blazor&version=6.0.14

What is Rystem?

Rystem.Authentication.Social.Blazor

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.

Install javascript

Setup js in app.razor in head or at the end

   <script src="_content/Rystem.Authentication.Social.Blazor/socialauthentications.js"></script>

DI - Example

var builder = WebApplication.CreateBuilder(args);

// Add services to the container.
builder.Services.AddRazorComponents()
    .AddInteractiveServerComponents();
builder.Services.AddSocialLoginUI(x =>
{
    x.ApiUrl = "https://localhost:7017";
    x.Google.ClientId = builder.Configuration["SocialLogin:Google:ClientId"];
    x.Microsoft.ClientId = builder.Configuration["SocialLogin:Microsoft:ClientId"];
});
builder.Services.AddRepository<SocialRole, string>(repositoryBuilder =>
{
    repositoryBuilder.WithApiClient(apiBuilder =>
    {
        apiBuilder.WithHttpClient("https://localhost:7017").WithDefaultRetryPolicy();
    });
});
builder.Services.AddDefaultAuthorizationInterceptorForApiHttpClient();
var app = builder.Build();

// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
{
    app.UseExceptionHandler("/Error", createScopeForErrors: true);
    // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
    app.UseHsts();
}

app.UseHttpsRedirection();

app.UseStaticFiles();
app.UseAntiforgery();

app
    .MapRazorComponents<App>()
    .AddInteractiveServerRenderMode();
app.Run();

Example for Routes.razor

<SocialAuthenticationRouter AppAssembly="typeof(Program).Assembly" DefaultLayout="typeof(Layout.MainLayout)">
</SocialAuthenticationRouter>

Example for logout

You may use the logout button

<SocialLogout></SocialLogout>

or create your custom logout through the SocialUser cascade parameter

[CascadingParameter(Name = "SocialUser")]
public SocialUserWrapper? SocialUser { get; set; }

private async ValueTask LogoutAsync()
{
    if (SocialUser != null)
        await SocialUser.LogoutAsync(false);
}
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.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
6.0.14 5,561 5/24/2024
6.0.13 87 5/23/2024
6.0.12 74 5/23/2024
6.0.11 86 5/20/2024
6.0.10 79 5/20/2024
6.0.9 91 5/20/2024
6.0.8 78 5/19/2024
6.0.7 81 5/18/2024