Session.Expired is always true
Dayjay opened this issue · 2 comments
Bug report
Describe the bug
Hello,
I am using Blazor WASM with Azure.
So far everything is fine except that Session.Expired()
always returns true for me. I checked what Expired() actually does and recreated it when I load and save the session:
//638325369830100000 (2023-10-10T12:16:23.009Z)
session.CreatedAt.Ticks
//3600
session.ExpiresIn
//10.10.2023 11:16:23 (ExpiredAt) - What happend here?
new DateTime(session.CreatedAt.Ticks).AddSeconds(session.ExpiresIn).ToUniversalTime())
//10.10.2023 12:19:15 (Now)
DateTime.UtcNow
The session should really just expire @ 13:16:22 UTC.
Since Expired() just checks if ExpiredAt < Now
it always returns true for me. If I remove the check it works as intended.
Might be a problem with UTC time conversion? If I use DateTimeOffset(session.CreatedAt)
instead of DateTime(session.CreatedAt.Ticks)
I get the expected result.
Additional context
Might be a problem with just Azure? I have used Supabase before not never the auth part. Let me know if I need to provide more info.
Makes sense to me. Want to send a PR?
Available in 4.2.3 - thanks @Dayjay!