What is expiresOn and extExpiresOn in result of acquireTokenByCode function call?

Nikhil Mandaniya 20 Reputation points
2024-03-19T13:50:58.04+00:00

First I am calling getAuthCodeUrl And then handling callback.

Here is my function that handles the callback after user login

async handleCallback(code: string): Promise<{ accessToken: string; refreshToken: string }> {
  const tokenRequest = {
    scopes,
    code,
    redirectUri,
    accessType: 'offline',
  };

  try {
    const authResult = await this.cca.acquireTokenByCode(tokenRequest);
    console.log('authResult: ', authResult);

    const accessToken = authResult.accessToken;
    const refreshToken = this.getRefreshToken();

    return { accessToken, refreshToken };
  } catch (error) {
    console.error('Error obtaining access token:', error);
    throw new Error('Error obtaining access token');
  }
}

In result of cca.acquireTokenByCode I am getting expiresOn and extExpiresOn with different values
expiresOn: 2024-03-19T14:38:04.000Z,

extExpiresOn: 2024-03-19T15:38:04.000Z,

I want to know what these 2 stands for. I read that msal-node But I didn't find details on result of function call.

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,674 questions
Active Directory
Active Directory
A set of directory-based technologies included in Windows Server.
5,908 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. awijekoon 950 Reputation points Microsoft Vendor
    2024-03-24T21:28:43.4766667+00:00

    'expiresOn' and 'extExpiresOn' are two properties related to token expiration. The first one shows the standard expiration time, while the second one shows any extended expiration time that may apply in some scenarios. This allows the application to handle token renewal properly.

    You may find these documents useful

    ExtendedExpiresOn

    expiresOn

    0 comments No comments