Starts in:
1 DAY
23 HRS
45 MIN
30 SEC
Starts in:
1 D
23 H
45 M
30 S
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 v9.1.0-preview. Updated on November 20, 2024, 13:06