I have a Blazor Server app
project authenticated via ASP.NET Identity cookies
, and I've added several APIs
to it using the minimal API
approach. These APIs are intended to be called through a mobile application
, and it's necessary for the APIs to be authenticated via JWT tokens
. What should I do to achieve this?
Current authentication Config:
builder.Services.AddCascadingAuthenticationState();builder.Services.AddScoped<IdentityUserAccessor>();builder.Services.AddScoped<IdentityRedirectManager>();builder.Services.AddScoped<AuthenticationStateProvider, IdentityRevalidatingAuthenticationStateProvider>();builder.Services.AddAuthentication(options =>{ options.DefaultScheme = IdentityConstants.ApplicationScheme; options.DefaultSignInScheme = IdentityConstants.ApplicationScheme;}).AddIdentityCookies();builder.Services.AddIdentityCore<User>(options => options.SignIn.RequireConfirmedAccount = false).AddRoles<Role>().AddEntityFrameworkStores<Infrastructure.Persistence.ApplicationDbContext>().AddSignInManager().AddDefaultTokenProviders();