dylanplecki / KeycloakOwinAuthentication

Keycloak Authentication Middleware for the C# OWIN Pipeline
http://keycloak.jboss.org
MIT License
56 stars 130 forks source link

Exception thrown when the machine uses local time zone #41

Open csmucsi opened 8 years ago

csmucsi commented 8 years ago

The following error is returned when the machine uses local time zone:

Server Error in '/' Application.

Both the access token and the refresh token have expired Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Exception: Both the access token and the refresh token have expired

Source Error:

Line 441: // Validate refresh token expiration Line 442: if (_refreshToken.ValidTo <= DateTime.Now) Line 443: throw new Exception("Both the access token and the refresh token have expired"); Line 444: Line 445: // Load new identity from token endpoint via refresh token

Source File: C:\Users\mcs\Documents\Visual Studio 2015\Projects\keycloak\KeycloakOwinAuthentication\src\KeycloakIdentityModel\KeycloakIdentity.cs Line: 443

Hint: DateTime.Now returns local time. Please consider using DateTime.UtcNow where needed.