Open Closed

OpenIddict change access token expiration time #3948


User avatar
0
alin.andersen created

Hey!

OpenIddict seems to have a default access token lifetime of 1 hour. How can we change this number? I was not able to find any information on the web regarding this.

Also I could not find anything here: https://docs.abp.io/en/abp/latest/Modules/OpenIddict

Can you point me to in the right direction?

  • ABP Framework version: v6.0.0
  • UI type: Blazor
  • DB provider: EF Core
  • Tiered (MVC)
Markdown supported.
Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)

2 Answer(s)
  • User Avatar
    0
    berkansasmaz created
    Support Team .NET Developer

    Hi, this issue doesn't seem to be related to ABP but you should be able to do it similar to the code below.

     PreConfigure<OpenIddictServerBuilder>(builder =>
    {
        builder.
               ... // In production, it is recommended to use two RSA certificates, one for encryption, one for signing.
               .SetAccessTokenLifetime(TimeSpan.FromDays(365))
               .SetIdentityTokenLifetime(TimeSpan.FromDays(365));
    });
    
    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    alin.andersen created

    Found the methods I needed:

    PreConfigure<OpenIddictBuilder>(builder =>
    {
        builder.AddServer(x =>
        {
            x.SetAccessTokenLifetime(...);
            x.SetIdentityTokenLifetime(...);
            x.SetRefreshTokenLifetime(...);
        });
    })
    

    Thanks!

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.8.0-preview. Updated on September 16, 2026, 14:50
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.