`expiresOn: new Date(authResult.expiresOn),` - https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/c8e74c3aaa87326ccce36eab041e2b25c600aeea/extensions/msal-node-extensions/src/broker/NativeBrokerPlugin.ts#L571
`expiresOn = new Date(Number(cacheRecord.accessToken.expiresOn) * 1000);` - https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/c8e74c3aaa87326ccce36eab041e2b25c600aeea/lib/msal-common/src/response/ResponseHandler.ts#L636C1-L637C1
Reproduction Steps
It seems like the MSAL functions PublicClientApplication.acquireTokenByUsernamePassword() and PublicClientApplication.acquireTokenInteractive() return tokens with expiry times measured in milliseconds and seconds since Epoch, respectively.
Thanks for the report. I've marked this as a bug and added to our internal backlog. We'll likely pick this up in our next major version as a change here in either direction could potentially be a breaking change.
Core Library
MSAL Node (@azure/msal-node)
Core Library Version
2.13.1
Wrapper Library
MSAL Node Extensions (@azure/msal-node-extensions)
Wrapper Library Version
1.1.0
Public or Confidential Client?
Public
Description
Hi! Why is expiresOn occasionally returned in milliseconds and sometimes in seconds?
Error Message
No response
MSAL Logs
No response
Network Trace (Preferrably Fiddler)
MSAL Configuration
Relevant Code Snippets
Reproduction Steps
It seems like the MSAL functions PublicClientApplication.acquireTokenByUsernamePassword() and PublicClientApplication.acquireTokenInteractive() return tokens with expiry times measured in milliseconds and seconds since Epoch, respectively.
Expected Behavior
expiresOn measured consistently
Identity Provider
Entra ID (formerly Azure AD) / MSA
Browsers Affected (Select all that apply)
None (Server)
Regression
No response
Source
Internal (Microsoft)