英文:
how can i change the OpenIddict AccessToken Lifetime in apb 7?
问题
如何更改访问令牌的默认到期时间?
英文:
enter image description here
How to change the default expiration time of accesstoken?
答案1
得分: 1
你可以在你的模块中使用这段代码:
context.Services.AddAuthentication(options =>
{
    // ...
})
.AddAbpOpenIdConnect("oidc", options =>
{
    // ...
    options.Events.OnTicketReceived = validatedContext =>
    {
        validatedContext.Properties.IsPersistent = true;
        validatedContext.Properties.ExpiresUtc = DateTimeOffset.UtcNow.AddDays(365);
        return Task.CompletedTask;
    };
});
英文:
You can use this code in your module
 context.Services.AddAuthentication(options =>
                {
                    ...
                })
                .AddAbpOpenIdConnect("oidc", options =>
                {
                    ...
                   
                    options.Events.OnTicketReceived = validatedContext =>
                    {
                        validatedContext.Properties.IsPersistent = true;
                        validatedContext.Properties.ExpiresUtc = DateTimeOffset.UtcNow.AddDays(365);
                        return Task.CompletedTask;
                    };
                });
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。


评论