Skip to content

BlazorWebAssemblyStandaloneWithIdentity - AddRoles #124

@adrianjcalvert

Description

@adrianjcalvert

Should this sample work fine with .AddRoles?

I've downloaded the sample and changed to a persistent DbContext, registered a user and then added the relevant records to AspNetRoles and AspNetUserRoles, but when I log in on the WASM app I don't get any role claims.. The cookie increases in size by ~100 chars so my guess is the API responding with a cookie that contains the role claim but the WASM app doesnt see it for some reason.

builder.Services.AddDbContext<AppDbContext>(options =>
{
    options.UseSqlServer(@"Server=(localdb)\mssqllocaldb;Database=Testdb;Trusted_Connection=True", assembly => assembly.MigrationsAssembly(typeof(AppDbContext).Assembly.FullName));
});

// add identity and opt-in to endpoints
builder.Services.AddIdentityCore<AppUser>()
    .AddRoles<IdentityRole>()
    .AddEntityFrameworkStores<AppDbContext>()
    .AddApiEndpoints();

image

Should they be sent in the response to manage/info?

image


Issue Details

Do not edit this section. It is required for issue processing.

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions