Open Closed

OpenIdDict custom grant type configuration #6822


User avatar
0
vitalii-rudkin created
  • ABP Framework version: v7.2.2
  • UI Type: Angular
  • Database System: EF Core (PostgreSQL)
  • Tiered (for MVC) or Auth Server Separated (for Angular): yes

Hi, Abp team

By reading this article (https://community.abp.io/posts/how-to-add-a-custom-grant-type-in-openiddict.-6v0df94z), I encountered the following question: Can we set a custom expiration time for access tokens only for certain grant types in OpenIddict? Or perhaps there are other tools available to achieve this, or does it require implementing another handler for it?

Best regards, Vitalii Rudkin


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

    Hi,

    You can try:

    .....
    claimsPrincipal.SetAccessTokenLifetime() // set access token lifetime
    
    ....
    await context.HttpContext.RequestServices.GetRequiredService<AbpOpenIddictClaimsPrincipalManager>().HandleAsync(context.Request, principal);
    return new SignInResult(OpenIddictServerAspNetCoreDefaults.AuthenticationScheme, claimsPrincipal);
    
Made with ❤️ on ABP v9.1.0-preview. Updated on December 13, 2024, 06:09