【问题标题】:Authorization code got immediately expired after time zone changed时区更改后授权码立即过期
【发布时间】:2021-01-07 04:08:08
【问题描述】:

我正在为 OpenId 服务器使用 OpenIdDict 库。当我在 EST (-5h) 时区时,一切都运行良好。但是当我移到 UTC+03 时区时,我不断收到错误消息:

OpenIddict.Server.Internal.OpenIddictServerHandler:错误:令牌 请求被拒绝,因为授权码或刷新 令牌已过期。

完全相同的代码。当我调用令牌交换端点时发生错误。我检查了数据库,所有值似乎都是正确的 UTC 值。

我发现错误是在 AspNet.Security.OpenIdConnect.Server\src\AspNet.Security.OpenIdConnect.Server\OpenIdConnectServerHandler.Exchange.cs 中触发的。但我不确定如何调试它。

【问题讨论】:

    标签: .net openid-connect openiddict


    【解决方案1】:

    该错误的原因是 Oracle MySql 驱动程序https://bugs.mysql.com/bug.php?id=92367 中的一个相当老的问题。如果您遇到同样的问题,您可以在这里找到很好的解释和解决方法:https://github.com/openiddict/openiddict-core/issues/1097#issuecomment-698374105。 目前最好的解决方案似乎是切换到 Pomelo 驱动程序:https://www.nuget.org/packages/Pomelo.EntityFrameworkCore.MySQL

    【讨论】:

    • 为了记录,这将在 OpenIddict 3.0 beta6 中修复,其中 EF Core/EF 6 商店现在使用 DateTime 而不是 DateTimeOffset
    猜你喜欢
    • 1970-01-01
    • 2014-02-19
    • 2019-08-03
    • 1970-01-01
    • 1970-01-01
    • 2017-05-27
    • 2022-10-09
    • 2020-06-05
    • 2014-11-19
    相关资源
    最近更新 更多