Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Unable to update Claim value #9540


User avatar
0
kasem created
  • What is your product version? v9.1.0-rc.1
  • What is your product type (Angular or MVC)? Angular
  • What is product framework type (.net framework or .net core)? .net core

I overrided CreateAsync to add a custom claim to user principal identity through UserClaimsPrincipalFactory and it works fine. I'm looking to modify this custom claim without relogin. I tried ReplaceClaimAsync method in UserManager and even called "await _signInManager.RefreshSignInAsync(user)" after updating claim but it didn't work. The claim modification is persisted in database but user session isn't affected until user relogin.


5 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team

    hi

    Angular is using JWT, so it can't be update. You can conside use RefreshToken method in Angular client to get a new token.

  • User Avatar
    0
    kasem created

    Thank you.

    I tried calling tryAuthWithRefreshToken in ZeroRefreshTokenService service but it didn't work since refreshToken cookie is always empty here. Please advice

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @kasem

    Refresh token is used when user selects "remember me" checkbox.

  • User Avatar
    0
    kasem created

    Hi @ismcagdas

    The problem that my users can't use RememberMe option. Do you have other way to achieve the needed?

    Thanks

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @kasem

    I can't offer you an alternative way. Angular app is storing JWT token and claims are stored in that token. So, you can't update it on the server. Best option is to use refresh token. If that's important for you, you can set RememberMe to true always in the code behind.