Open Closed

how can I add some data to AccessToken JWT'data? #2905


User avatar
0
abllyboy created
  • ABP Framework version: v5.2.0
  • UI type: MVC r
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): yes
  • Exception message and stack trace:
  • Steps to reproduce the issue:"
  • Step1 I added my ClaimsPrincipalFactory in *.IdentityServer and added a claim named 'organizeName' like below
  • Step2 And also I added organizeName in the "Identity resources" like below:
  • Step3 Then I can found organizeName by CurrentUser.GetAllClaims() like below:
  • Step4 And also add identity resources "organizeName" to Client "Infrastructure_App", like below:
  • Step5And then I use Postman to get token, but the returned access_token' data don't contains my "organizeName" property.
  • So how can I add organizeName to JWT's data?

2 Answer(s)
  • User Avatar
    1
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Try:

    Configure<AbpClaimsServiceOptions>(options=>
    {
        options.RequestedClaims.Add(claimName...)
    })
    
  • User Avatar
    0
    abllyboy created

    It works,YYDS

Made with ❤️ on ABP v9.1.0-preview. Updated on November 11, 2024, 11:11