Andrew
Andrew

Reputation: 404

Authorization code got immediately expired after time zone changed

I'm using OpenIdDict library for OpenId server. Everything worked perfectly when I was in EST (-5h) time zone. But when I moved to UTC+03 time zone I'm constantly getting an error:

OpenIddict.Server.Internal.OpenIddictServerHandler: Error: The token request was rejected because the authorization code or the refresh token was expired.

exactly on the same code. The error occurs when I call token exchange endpoint. I checked database and all values there seems to be correct UTC values.

I found that the error was fired at AspNet.Security.OpenIdConnect.Server\src\AspNet.Security.OpenIdConnect.Server\OpenIdConnectServerHandler.Exchange.cs. But I'm not sure how to debug it.

Upvotes: 0

Views: 488

Answers (1)

Andrew
Andrew

Reputation: 404

The reason of the bug is pretty old issue in Oracle MySql driver https://bugs.mysql.com/bug.php?id=92367. If you faced the same problem you can find pretty good explanation and workaround here: https://github.com/openiddict/openiddict-core/issues/1097#issuecomment-698374105. For now the best solution seems to be switching to the Pomelo driver: https://www.nuget.org/packages/Pomelo.EntityFrameworkCore.MySQL

Upvotes: 0

Related Questions