Skip to content

How to refresh updated Claims without login out #22405

@Alienroid

Description

@Alienroid

I am using Blazor Server Side.

This document specified "SignInManager and UserManager aren't supported in Razor components."

I have a custom Claim (example FirstName) by following the documentation. I can read it with "user.Claims.FirstOrDefault(s => s.Type == "FirstName")?.Value". If I update this Claim. When I read this from Claim, it was getting the previously Claim (I believe it is not refreshed). How do I refresh this Claim without using SignInManager/UserManager:

var user = await _userManager.GetUserAsync(User);
await _signInManager.RefreshSignInAsync(user);

If I look at the database, the value is updated. If I logout and re-login, the value is updated.


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions