Ability to return UTC times in token responses?
-
Hello!
I’m working on integrating this plugin to connect with third-party services using OIDC, and we’re discovering that the token issue and expiration dates are being returned based on the WordPress application timezone. The third-party service in this case is using UTC for its base time, so access tokens, refresh tokens, and id tokens are coming back expired as soon as they’re issued.
I dug through the code a little bit and found the
wo_jwt_token
filter that allowed me to convert those timestamps to UTC in the response (but keep them the same in the local database), but it doesn’t appear that there’s a similar filter for refresh tokens or id tokens.WPOAuth2\ResponseType\JwtAccessToken::createAccessToken
also sets the expiration time for the refresh token on line 107 of the class file before passing it to the Storage object, but that expiration data is not wrapped in a filter.Similarly,
WPOAuth2\OpenID\ResponseType\IdToken::createIdToken
sets times foriat
andexp
using the WordPress current time, and those values are not filtered.Would it be possible to develop a solution to this? Some options would be:
– Wrapping the expiration for the token expiration in a filter so that the return timestamp can be modified as it is with thewo_jwt_token
filter.
– Creating a setting on a per-client basis that allows administrators to select the correct timezone for clients, with UTC as the default since it’s likely that’s the basis for most implementations.
– Some other approach I’m not considering?In the meantime, please let me know if there exists another way to change this value that I’m not seeing, and/or proposed solutions to this problem.
Thank you for developing this wonderful plugin!
- The topic ‘Ability to return UTC times in token responses?’ is closed to new replies.