Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expiresOn recorded inconsistently? #7371

Open
2 tasks
sohinik opened this issue Oct 9, 2024 · 1 comment
Open
2 tasks

expiresOn recorded inconsistently? #7371

sohinik opened this issue Oct 9, 2024 · 1 comment
Labels
bug A problem that needs to be fixed for the feature to function as intended. msal-node Related to msal-node package msal-node-extensions Related to msal-node-extensions package public-client Issues regarding PublicClientApplications

Comments

@sohinik
Copy link

sohinik commented Oct 9, 2024

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)

  • Sent
  • Pending

MSAL Configuration

{
  auth: {
    clientId: "d3590ed6-52b3-4102-aeff-aad2292ab01c",
    authority: "https://login.microsoftonline.com/organizations/",
    clientCapabilities: [
      "CP1",
    ],
  },
  broker: {
    nativeBrokerPlugin: {
      logger: {
        level: 2,
        localCallback: () => {
          // Empty logger callback
        },
        piiLoggingEnabled: false,
        correlationId: "",
        packageName: "@azure/msal-node-extensions",
        packageVersion: "1.1.0",
      },
      isBrokerAvailable: true,
    },
  },
}

Relevant Code Snippets

`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.

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)

@sohinik sohinik added bug-unconfirmed A reported bug that needs to be investigated and confirmed question Customer is asking for a clarification, use case or information. labels Oct 9, 2024
@github-actions github-actions bot added msal-node Related to msal-node package msal-node-extensions Related to msal-node-extensions package public-client Issues regarding PublicClientApplications labels Oct 9, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs: Attention 👋 Awaiting response from the MSAL.js team label Oct 9, 2024
@tnorling tnorling added bug A problem that needs to be fixed for the feature to function as intended. and removed bug-unconfirmed A reported bug that needs to be investigated and confirmed labels Oct 10, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot removed question Customer is asking for a clarification, use case or information. Needs: Attention 👋 Awaiting response from the MSAL.js team labels Oct 10, 2024
@tnorling
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A problem that needs to be fixed for the feature to function as intended. msal-node Related to msal-node package msal-node-extensions Related to msal-node-extensions package public-client Issues regarding PublicClientApplications
Projects
None yet
Development

No branches or pull requests

2 participants