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)

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));
    });
    
  • User Avatar
    0
    alin.andersen created

    Found the methods I needed:

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

    Thanks!

Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11