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

After implementation of the partition manager, the account is not removed from the cache anymore @azure/msal-node #7324

Open
2 tasks
LuccaRebelloToledo opened this issue Sep 19, 2024 · 4 comments
Labels
bug-unconfirmed A reported bug that needs to be investigated and confirmed confidential-client Issues regarding ConfidentialClientApplications msal-node Related to msal-node package Needs: Attention 👋 Awaiting response from the MSAL.js team question Customer is asking for a clarification, use case or information.

Comments

@LuccaRebelloToledo
Copy link

LuccaRebelloToledo commented Sep 19, 2024

Core Library

MSAL Node (@azure/msal-node)

Core Library Version

2.13.1

Wrapper Library

Not Applicable

Wrapper Library Version

0.0.0

Public or Confidential Client?

Confidential

Description

After implementing the partition manager, the remove Account method no longer works, the storage token is not removed or becomes empty data.

CacheClient Implementation
{F79797B4-398E-48A2-B85A-D056471B0402}

Partition Manager Implementation
{8550F8EA-2D06-46EF-BF93-DC0EE09F46E4}

RemoveAccount Implementation
{52E3F2EB-F325-4FD7-B712-275D71258B4D}

Error Message

Nothing Error Messages.

MSAL Logs

2024-09-20T12:32:02.167Z 824ae031-e9d2-474e-b4a4-a3bef1feed3b INFO Level: 2 Message: [Fri, 20 Sep 2024 12:32:02 GMT] : [] : @azure/[email protected] : Info - getTokenCache called

2024-09-20T12:32:02.167Z 824ae031-e9d2-474e-b4a4-a3bef1feed3b INFO Level: 4 Message: [Fri, 20 Sep 2024 12:32:02 GMT] : [] : @azure/[email protected] : Trace - getAllAccounts called

2024-09-20T12:32:02.428Z 824ae031-e9d2-474e-b4a4-a3bef1feed3b INFO Level: 4 Message: [Fri, 20 Sep 2024 12:32:02 GMT] : [] : @azure/[email protected] : Trace - Deserializing JSON to in-memory cache

2024-09-20T12:32:02.428Z 824ae031-e9d2-474e-b4a4-a3bef1feed3b INFO Level: 4 Message: [Fri, 20 Sep 2024 12:32:02 GMT] : [] : @azure/[email protected] : Trace - Reading cache snapshot from disk

2024-09-20T12:32:02.428Z 824ae031-e9d2-474e-b4a4-a3bef1feed3b INFO Level: 4 Message: [Fri, 20 Sep 2024 12:32:02 GMT] : [] : @azure/[email protected] : Trace - Overlaying input cache with the default cache

2024-09-20T12:32:02.428Z 824ae031-e9d2-474e-b4a4-a3bef1feed3b INFO Level: 4 Message: [Fri, 20 Sep 2024 12:32:02 GMT] : [] : @azure/[email protected] : Trace - Setting in-memory cache

2024-09-20T12:32:02.428Z 824ae031-e9d2-474e-b4a4-a3bef1feed3b INFO Level: 4 Message: [Fri, 20 Sep 2024 12:32:02 GMT] : [] : @azure/[email protected] : Trace - Getting cache key-value store

2024-09-20T12:32:02.428Z 824ae031-e9d2-474e-b4a4-a3bef1feed3b INFO Level: 4 Message: [Fri, 20 Sep 2024 12:32:02 GMT] : [] : @azure/[email protected] : Trace - Setting cache key value store

2024-09-20T12:32:02.428Z 824ae031-e9d2-474e-b4a4-a3bef1feed3b INFO Level: 4 Message: [Fri, 20 Sep 2024 12:32:02 GMT] : [] : @azure/[email protected] : Trace - Getting in-memory cache

2024-09-20T12:32:02.428Z 824ae031-e9d2-474e-b4a4-a3bef1feed3b INFO Level: 4 Message: [Fri, 20 Sep 2024 12:32:02 GMT] : [] : @azure/[email protected] : Trace - Getting cache key-value store

2024-09-20T12:32:02.428Z 824ae031-e9d2-474e-b4a4-a3bef1feed3b INFO Level: 4 Message: [Fri, 20 Sep 2024 12:32:02 GMT] : [] : @azure/[email protected] : Trace - Getting cache key-value store

2024-09-20T12:32:02.428Z 824ae031-e9d2-474e-b4a4-a3bef1feed3b INFO Level: 4 Message: [Fri, 20 Sep 2024 12:32:02 GMT] : [] : @azure/[email protected] : Trace - Getting cache key-value store

2024-09-20T12:32:02.428Z 824ae031-e9d2-474e-b4a4-a3bef1feed3b INFO Level: 4 Message: [Fri, 20 Sep 2024 12:32:02 GMT] : [] : @azure/[email protected] : Trace - Getting in-memory cache

2024-09-20T12:32:02.428Z 824ae031-e9d2-474e-b4a4-a3bef1feed3b INFO Level: 4 Message: [Fri, 20 Sep 2024 12:32:02 GMT] : [] : @azure/[email protected] : Trace - Getting cache key-value store

2024-09-20T12:32:02.428Z 824ae031-e9d2-474e-b4a4-a3bef1feed3b INFO Level: 4 Message: [Fri, 20 Sep 2024 12:32:02 GMT] : [] : @azure/[email protected] : Trace - CacheManager - getIdToken called

2024-09-20T12:32:02.428Z 824ae031-e9d2-474e-b4a4-a3bef1feed3b INFO Level: 4 Message: [Fri, 20 Sep 2024 12:32:02 GMT] : [] : @azure/[email protected] : Trace - Getting cache key-value store

2024-09-20T12:32:02.429Z 824ae031-e9d2-474e-b4a4-a3bef1feed3b INFO Level: 4 Message: [Fri, 20 Sep 2024 12:32:02 GMT] : [] : @azure/[email protected] : Trace - getAliasesFromMetadata called with source: config

2024-09-20T12:32:02.429Z 824ae031-e9d2-474e-b4a4-a3bef1feed3b INFO Level: 4 Message: [Fri, 20 Sep 2024 12:32:02 GMT] : [] : @azure/[email protected] : Trace - getAliasesFromMetadata called with source: hardcoded_values

2024-09-20T12:32:02.429Z 824ae031-e9d2-474e-b4a4-a3bef1feed3b INFO Level: 4 Message: [Fri, 20 Sep 2024 12:32:02 GMT] : [] : @azure/[email protected] : Trace - getAliasesFromMetadata: found cloud discovery metadata in hardcoded_values, returning aliases

2024-09-20T12:32:02.429Z 824ae031-e9d2-474e-b4a4-a3bef1feed3b INFO Level: 2 Message: [Fri, 20 Sep 2024 12:32:02 GMT] : [] : @azure/[email protected] : Info - CacheManager:getIdToken - Returning ID token

2024-09-20T12:32:02.429Z 824ae031-e9d2-474e-b4a4-a3bef1feed3b INFO Level: 4 Message: [Fri, 20 Sep 2024 12:32:02 GMT] : [] : @azure/[email protected] : Trace - Getting cache key-value store

2024-09-20T12:32:02.429Z 824ae031-e9d2-474e-b4a4-a3bef1feed3b INFO Level: 4 Message: [Fri, 20 Sep 2024 12:32:02 GMT] : [] : @azure/[email protected] : Trace - Serializing in-memory cache

2024-09-20T12:32:02.429Z 824ae031-e9d2-474e-b4a4-a3bef1feed3b INFO Level: 4 Message: [Fri, 20 Sep 2024 12:32:02 GMT] : [] : @azure/[email protected] : Trace - Getting in-memory cache

2024-09-20T12:32:02.429Z 824ae031-e9d2-474e-b4a4-a3bef1feed3b INFO Level: 4 Message: [Fri, 20 Sep 2024 12:32:02 GMT] : [] : @azure/[email protected] : Trace - Getting cache key-value store

2024-09-20T12:32:02.429Z 824ae031-e9d2-474e-b4a4-a3bef1feed3b INFO Level: 4 Message: [Fri, 20 Sep 2024 12:32:02 GMT] : [] : @azure/[email protected] : Trace - Reading cache snapshot from disk

2024-09-20T12:32:02.429Z 824ae031-e9d2-474e-b4a4-a3bef1feed3b INFO Level: 4 Message: [Fri, 20 Sep 2024 12:32:02 GMT] : [] : @azure/[email protected] : Trace - Merging in-memory cache with cache snapshot

2024-09-20T12:32:02.429Z 824ae031-e9d2-474e-b4a4-a3bef1feed3b INFO Level: 4 Message: [Fri, 20 Sep 2024 12:32:02 GMT] : [] : @azure/[email protected] : Trace - Remove updated entries in cache

2024-09-20T12:32:02.608Z 824ae031-e9d2-474e-b4a4-a3bef1feed3b INFO Level: 2 Message: [Fri, 20 Sep 2024 12:32:02 GMT] : [] : @azure/[email protected] : Info - getTokenCache called

2024-09-20T12:32:02.608Z 824ae031-e9d2-474e-b4a4-a3bef1feed3b INFO Level: 4 Message: [Fri, 20 Sep 2024 12:32:02 GMT] : [] : @azure/[email protected] : Trace - removeAccount called

2024-09-20T12:32:02.708Z 824ae031-e9d2-474e-b4a4-a3bef1feed3b INFO Level: 4 Message: [Fri, 20 Sep 2024 12:32:02 GMT] : [] : @azure/[email protected] : Trace - Deserializing JSON to in-memory cache

2024-09-20T12:32:02.708Z 824ae031-e9d2-474e-b4a4-a3bef1feed3b INFO Level: 4 Message: [Fri, 20 Sep 2024 12:32:02 GMT] : [] : @azure/[email protected] : Trace - Reading cache snapshot from disk

2024-09-20T12:32:02.708Z 824ae031-e9d2-474e-b4a4-a3bef1feed3b INFO Level: 4 Message: [Fri, 20 Sep 2024 12:32:02 GMT] : [] : @azure/[email protected] : Trace - Overlaying input cache with the default cache

2024-09-20T12:32:02.708Z 824ae031-e9d2-474e-b4a4-a3bef1feed3b INFO Level: 4 Message: [Fri, 20 Sep 2024 12:32:02 GMT] : [] : @azure/[email protected] : Trace - Setting in-memory cache

2024-09-20T12:32:02.708Z 824ae031-e9d2-474e-b4a4-a3bef1feed3b INFO Level: 4 Message: [Fri, 20 Sep 2024 12:32:02 GMT] : [] : @azure/[email protected] : Trace - Getting cache key-value store

2024-09-20T12:32:02.708Z 824ae031-e9d2-474e-b4a4-a3bef1feed3b INFO Level: 4 Message: [Fri, 20 Sep 2024 12:32:02 GMT] : [] : @azure/[email protected] : Trace - Setting cache key value store

2024-09-20T12:32:02.708Z 824ae031-e9d2-474e-b4a4-a3bef1feed3b INFO Level: 4 Message: [Fri, 20 Sep 2024 12:32:02 GMT] : [] : @azure/[email protected] : Trace - Getting cache key-value store

2024-09-20T12:32:02.708Z 824ae031-e9d2-474e-b4a4-a3bef1feed3b INFO Level: 4 Message: [Fri, 20 Sep 2024 12:32:02 GMT] : [] : @azure/[email protected] : Trace - Getting cache key-value store

2024-09-20T12:32:02.708Z 824ae031-e9d2-474e-b4a4-a3bef1feed3b INFO Level: 4 Message: [Fri, 20 Sep 2024 12:32:02 GMT] : [] : @azure/[email protected] : Trace - Getting in-memory cache

2024-09-20T12:32:02.708Z 824ae031-e9d2-474e-b4a4-a3bef1feed3b INFO Level: 4 Message: [Fri, 20 Sep 2024 12:32:02 GMT] : [] : @azure/[email protected] : Trace - Getting cache key-value store

2024-09-20T12:32:02.709Z 824ae031-e9d2-474e-b4a4-a3bef1feed3b INFO Level: 4 Message: [Fri, 20 Sep 2024 12:32:02 GMT] : [] : @azure/[email protected] : Trace - Getting cache key-value store

2024-09-20T12:32:02.709Z 824ae031-e9d2-474e-b4a4-a3bef1feed3b INFO Level: 4 Message: [Fri, 20 Sep 2024 12:32:02 GMT] : [] : @azure/[email protected] : Trace - Setting cache key value store

2024-09-20T12:32:02.709Z 824ae031-e9d2-474e-b4a4-a3bef1feed3b INFO Level: 4 Message: [Fri, 20 Sep 2024 12:32:02 GMT] : [] : @azure/[email protected] : Trace - Getting cache key-value store

2024-09-20T12:32:02.709Z 824ae031-e9d2-474e-b4a4-a3bef1feed3b INFO Level: 4 Message: [Fri, 20 Sep 2024 12:32:02 GMT] : [] : @azure/[email protected] : Trace - Getting cache key-value store

2024-09-20T12:32:02.709Z 824ae031-e9d2-474e-b4a4-a3bef1feed3b INFO Level: 4 Message: [Fri, 20 Sep 2024 12:32:02 GMT] : [] : @azure/[email protected] : Trace - Setting cache key value store

2024-09-20T12:32:02.709Z 824ae031-e9d2-474e-b4a4-a3bef1feed3b INFO Level: 4 Message: [Fri, 20 Sep 2024 12:32:02 GMT] : [] : @azure/[email protected] : Trace - Getting cache key-value store

2024-09-20T12:32:02.709Z 824ae031-e9d2-474e-b4a4-a3bef1feed3b INFO Level: 4 Message: [Fri, 20 Sep 2024 12:32:02 GMT] : [] : @azure/[email protected] : Trace - Setting cache key value store

2024-09-20T12:32:02.709Z 824ae031-e9d2-474e-b4a4-a3bef1feed3b INFO Level: 4 Message: [Fri, 20 Sep 2024 12:32:02 GMT] : [] : @azure/[email protected] : Trace - Getting cache key-value store

2024-09-20T12:32:02.709Z 824ae031-e9d2-474e-b4a4-a3bef1feed3b INFO Level: 4 Message: [Fri, 20 Sep 2024 12:32:02 GMT] : [] : @azure/[email protected] : Trace - Setting cache key value store

2024-09-20T12:32:02.709Z 824ae031-e9d2-474e-b4a4-a3bef1feed3b INFO Level: 4 Message: [Fri, 20 Sep 2024 12:32:02 GMT] : [] : @azure/[email protected] : Trace - Getting cache key-value store

Network Trace (Preferrably Fiddler)

  • Sent
  • Pending

MSAL Configuration

{
    auth: {
      clientId: OUTLOOK_CLIENT_ID,
      clientSecret: OUTLOOK_CLIENT_SECRET,
    },
    cache: {
      cachePlugin: new DistributedCachePlugin(
        new CacheClient(),
        new PartitionManager(homeAccountId || APP)
      ),
    },
    system: {
      loggerOptions: {
        loggerCallback: (level, message, containsPii) => {
          if (!containsPii) {
            log.log(`Level: ${level}`, `Message: ${message}`);
          }
        },
        piiLoggingEnabled: false,
      },
    },
    telemetry: {
      application: {
        appName: APP,
        appVersion: '1.0.0',
      },
    },
  }

Relevant Code Snippets

import { ICacheClient } from '@azure/msal-node';

import { DynamoDBDocument } from '@aws-sdk/lib-dynamodb';

import { getCacheStorageTableName, getDynamoDBClient } from './dynamo-db';

export default class CacheClient implements ICacheClient {
  private readonly client: DynamoDBDocument;
  private readonly tableName: string;

  constructor() {
    this.client = getDynamoDBClient();
    this.tableName = getCacheStorageTableName();
  }

  public async get(key: string): Promise<string> {
    const { Item } = await this.client.get({
      TableName: this.tableName,
      Key: { cache_identifier: key },
    });

    if (!Item) {
      return '';
    }

    const { serialized_token: serializedToken } = Item;

    return serializedToken;
  }

  public async set(key: string, value: string): Promise<string> {
    await this.client.put({
      TableName: this.tableName,
      Item: {
        cache_identifier: key,
        serialized_token: value,
      },
    });

    return 'OK';
  }
}

import { IPartitionManager } from '@azure/msal-node';

import { AccountEntity } from '@azure/msal-common';

import OutlookErrorMessages from './errors/outlook';

export default class PartitionManager implements IPartitionManager {
  private readonly homeAccountId: string;

  constructor(homeAccountId: string) {
    this.homeAccountId = homeAccountId;
  }

  public async getKey(): Promise<string> {
    return this.homeAccountId;
  }

  public async extractKey(accountEntity: AccountEntity): Promise<string> {
    const { homeAccountId } = accountEntity;

    if (!homeAccountId) {
      throw new Error(OutlookErrorMessages.accounts.cacheEntity.notFound);
    }

    return homeAccountId;
  }
}

export const removeAccount = async (homeAccountId: string) => {
  const msalClient = getMSALClient(homeAccountId);

  const account = await getAccountByHomeId({ msalClient, homeAccountId });

  // After implementation of the partition manager, the account is not removed from the cache anymore
  await msalClient.getTokenCache().removeAccount(account);
};

Reproduction Steps

  1. get auth code url
  2. acquire token by code ( in this moment, the token cache is stored. )
  3. call the remove account.

Expected Behavior

I hope of the stored cache is remove or data empty. Independent of the cache client i using.

My cache data after using the removeAccount method:
{1CD3D84E-4672-46A8-A211-5A525976748D}

Identity Provider

Entra ID (formerly Azure AD) / MSA

Browsers Affected (Select all that apply)

None (Server)

Regression

No response

Source

Internal (Microsoft)

@LuccaRebelloToledo LuccaRebelloToledo 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 Sep 19, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs: Attention 👋 Awaiting response from the MSAL.js team label Sep 19, 2024
@github-actions github-actions bot added confidential-client Issues regarding ConfidentialClientApplications msal-node Related to msal-node package labels Sep 19, 2024
@LuccaRebelloToledo
Copy link
Author

I forked the repository and create a new versions of msal-common and msal-node with more logs for better analyze. The removeAccount method is called correct but in the removeAccountContext method on "lib\msal-common\src\cache\CacheManager.ts", the keys is not removed.

removeAccountContext Method:
{0B13612E-42D8-496A-A1CA-DFEB1EDC8B97}

Logs:

2024-09-20T14:13:36.943Z 5ccde16d-ad8f-41be-80d3-82c873cb9c48 INFO Level: 4 Message: [Fri, 20 Sep 2024 14:13:36 GMT] : [] : @azure/[email protected] : Trace - Removing account from cache: 00000000-0000-0000-c2ad-4496109a7efd.9188040d-6c67-4c5b-b112-36a304b66dad-login.windows.net-9188040d-6c67-4c5b-b112-36a304b66dad --

2024-09-20T14:13:36.944Z 5ccde16d-ad8f-41be-80d3-82c873cb9c48 INFO Level: 4 Message: [Fri, 20 Sep 2024 14:13:36 GMT] : [] : @azure/[email protected] : Trace - CacheManager.removeAccount called with key: 00000000-0000-0000-c2ad-4496109a7efd.9188040d-6c67-4c5b-b112-36a304b66dad-login.windows.net-9188040d-6c67-4c5b-b112-36a304b66dad

2024-09-20T14:13:36.944Z 5ccde16d-ad8f-41be-80d3-82c873cb9c48 INFO Level: 4 Message: [Fri, 20 Sep 2024 14:13:36 GMT] : [] : @azure/[email protected] : Trace - Getting cache key-value store

2024-09-20T14:13:36.944Z 5ccde16d-ad8f-41be-80d3-82c873cb9c48 INFO Level: 4 Message: [Fri, 20 Sep 2024 14:13:36 GMT] : [] : @azure/[email protected] : Trace - Getting cache key-value store

2024-09-20T14:13:36.944Z 5ccde16d-ad8f-41be-80d3-82c873cb9c48 INFO Level: 4 Message: [Fri, 20 Sep 2024 14:13:36 GMT] : [] : @azure/[email protected] : Trace - CacheManager.removeAccount found account: 00000000-0000-0000-c2ad-4496109a7efd.9188040d-6c67-4c5b-b112-36a304b66dad

2024-09-20T14:13:36.944Z 5ccde16d-ad8f-41be-80d3-82c873cb9c48 INFO Level: 4 Message: [Fri, 20 Sep 2024 14:13:36 GMT] : [] : @azure/[email protected] : Trace - Getting in-memory cache

2024-09-20T14:13:36.944Z 5ccde16d-ad8f-41be-80d3-82c873cb9c48 INFO Level: 4 Message: [Fri, 20 Sep 2024 14:13:36 GMT] : [] : @azure/[email protected] : Trace - Getting cache key-value store

2024-09-20T14:13:36.944Z 5ccde16d-ad8f-41be-80d3-82c873cb9c48 INFO Level: 4 Message: [Fri, 20 Sep 2024 14:13:36 GMT] : [] : @azure/[email protected] : Trace - All token keys before: { "idToken": [ "00000000-0000-0000-c2ad-4496109a7efd.9188040d-6c67-4c5b-b112-36a304b66dad-login.windows.net-idtoken-4443f941-37fc-4834-8919-440a8d0a2ed0-9188040d-6c67-4c5b-b112-36a304b66dad---" ], "accessToken": [ "00000000-0000-0000-c2ad-4496109a7efd.9188040d-6c67-4c5b-b112-36a304b66dad-login.windows.net-accesstoken-4443f941-37fc-4834-8919-440a8d0a2ed0-9188040d-6c67-4c5b-b112-36a304b66dad-user.read calendars.readwrite openid profile--" ], "refreshToken": [ "00000000-0000-0000-c2ad-4496109a7efd.9188040d-6c67-4c5b-b112-36a304b66dad-login.windows.net-refreshtoken-4443f941-37fc-4834-8919-440a8d0a2ed0----" ] }

2024-09-20T14:13:36.944Z 5ccde16d-ad8f-41be-80d3-82c873cb9c48 INFO Level: 4 Message: [Fri, 20 Sep 2024 14:13:36 GMT] : [] : @azure/[email protected] : Trace - Getting cache key-value store

2024-09-20T14:13:36.944Z 5ccde16d-ad8f-41be-80d3-82c873cb9c48 INFO Level: 4 Message: [Fri, 20 Sep 2024 14:13:36 GMT] : [] : @azure/[email protected] : Trace - Setting cache key value store

2024-09-20T14:13:36.944Z 5ccde16d-ad8f-41be-80d3-82c873cb9c48 INFO Level: 4 Message: [Fri, 20 Sep 2024 14:13:36 GMT] : [] : @azure/[email protected] : Trace - Getting cache key-value store

2024-09-20T14:13:36.944Z 5ccde16d-ad8f-41be-80d3-82c873cb9c48 INFO Level: 4 Message: [Fri, 20 Sep 2024 14:13:36 GMT] : [] : @azure/[email protected] : Trace - Getting cache key-value store

2024-09-20T14:13:36.944Z 5ccde16d-ad8f-41be-80d3-82c873cb9c48 INFO Level: 4 Message: [Fri, 20 Sep 2024 14:13:36 GMT] : [] : @azure/[email protected] : Trace - Setting cache key value store

2024-09-20T14:13:36.944Z 5ccde16d-ad8f-41be-80d3-82c873cb9c48 INFO Level: 4 Message: [Fri, 20 Sep 2024 14:13:36 GMT] : [] : @azure/[email protected] : Trace - Getting cache key-value store

2024-09-20T14:13:36.944Z 5ccde16d-ad8f-41be-80d3-82c873cb9c48 INFO Level: 4 Message: [Fri, 20 Sep 2024 14:13:36 GMT] : [] : @azure/[email protected] : Trace - Setting cache key value store

2024-09-20T14:13:36.944Z 5ccde16d-ad8f-41be-80d3-82c873cb9c48 INFO Level: 4 Message: [Fri, 20 Sep 2024 14:13:36 GMT] : [] : @azure/[email protected] : Trace - All token keys after: { "idToken": [ "00000000-0000-0000-c2ad-4496109a7efd.9188040d-6c67-4c5b-b112-36a304b66dad-login.windows.net-idtoken-4443f941-37fc-4834-8919-440a8d0a2ed0-9188040d-6c67-4c5b-b112-36a304b66dad---" ], "accessToken": [ "00000000-0000-0000-c2ad-4496109a7efd.9188040d-6c67-4c5b-b112-36a304b66dad-login.windows.net-accesstoken-4443f941-37fc-4834-8919-440a8d0a2ed0-9188040d-6c67-4c5b-b112-36a304b66dad-user.read calendars.readwrite openid profile--" ], "refreshToken": [ "00000000-0000-0000-c2ad-4496109a7efd.9188040d-6c67-4c5b-b112-36a304b66dad-login.windows.net-refreshtoken-4443f941-37fc-4834-8919-440a8d0a2ed0----" ] }

2024-09-20T14:13:36.944Z 5ccde16d-ad8f-41be-80d3-82c873cb9c48 INFO Level: 4 Message: [Fri, 20 Sep 2024 14:13:36 GMT] : [] : @azure/[email protected] : Trace - Getting cache key-value store

2024-09-20T14:13:36.944Z 5ccde16d-ad8f-41be-80d3-82c873cb9c48 INFO Level: 4 Message: [Fri, 20 Sep 2024 14:13:36 GMT] : [] : @azure/[email protected] : Trace - Setting cache key value store

2024-09-20T14:13:36.944Z 5ccde16d-ad8f-41be-80d3-82c873cb9c48 INFO Level: 4 Message: [Fri, 20 Sep 2024 14:13:36 GMT] : [] : @azure/[email protected] : Trace - Getting cache key-value store

@LuccaRebelloToledo
Copy link
Author

LuccaRebelloToledo commented Sep 20, 2024

In new tests, I added more logs inside the loops.

{D8B96FA5-EE89-4CE3-B161-C0035BB5E57C}

2024-09-20T14:32:09.586Z 9b77ce8b-458e-4ee8-aeda-791386b0c117 INFO Level: 4 Message: [Fri, 20 Sep 2024 14:32:09 GMT] : [] : @azure/[email protected] : Trace - Account ID: 00000000-0000-0000-c2ad-4496109a7efd.9188040d-6c67-4c5b-b112-36a304b66dad-login.windows.net --

2024-09-20T14:32:09.586Z 9b77ce8b-458e-4ee8-aeda-791386b0c117 INFO Level: 4 Message: [Fri, 20 Sep 2024 14:32:09 GMT] : [] : @azure/[email protected] : Trace - idToken - Checking key: 00000000-0000-0000-c2ad-4496109a7efd.9188040d-6c67-4c5b-b112-36a304b66dad-login.windows.net-idtoken-4443f941-37fc-4834-8919-440a8d0a2ed0-9188040d-6c67-4c5b-b112-36a304b66dad---

2024-09-20T14:32:09.586Z 9b77ce8b-458e-4ee8-aeda-791386b0c117 INFO Level: 4 Message: [Fri, 20 Sep 2024 14:32:09 GMT] : [] : @azure/[email protected] : Trace - Removing idToken key: 00000000-0000-0000-c2ad-4496109a7efd.9188040d-6c67-4c5b-b112-36a304b66dad-login.windows.net-idtoken-4443f941-37fc-4834-8919-440a8d0a2ed0-9188040d-6c67-4c5b-b112-36a304b66dad---

@LuccaRebelloToledo
Copy link
Author

2024-09-20T14:59:16.062Z 6dcfe0e2-2658-48d3-870a-ff75914238b2 INFO Level: 4 Message: [Fri, 20 Sep 2024 14:59:16 GMT] : [] : @azure/[email protected] : Trace - Removing cache item with key: 00000000-0000-0000-c2ad-4496109a7efd.9188040d-6c67-4c5b-b112-36a304b66dad-login.windows.net-9188040d-6c67-4c5b-b112-36a304b66dad --

2024-09-20T14:59:16.062Z 6dcfe0e2-2658-48d3-870a-ff75914238b2 INFO Level: 4 Message: [Fri, 20 Sep 2024 14:59:16 GMT] : [] : @azure/[email protected] : Trace - Successfully removed cache item with key: 00000000-0000-0000-c2ad-4496109a7efd.9188040d-6c67-4c5b-b112-36a304b66dad-login.windows.net-9188040d-6c67-4c5b-b112-36a304b66dad

2024-09-20T14:59:16.062Z 6dcfe0e2-2658-48d3-870a-ff75914238b2 INFO Level: 4 Message: [Fri, 20 Sep 2024 14:59:16 GMT] : [] : @azure/[email protected] : Trace - Cache after removal: {}

2024-09-20T14:59:16.062Z 6dcfe0e2-2658-48d3-870a-ff75914238b2 INFO Level: 4 Message: [Fri, 20 Sep 2024 14:59:16 GMT] : [] : @azure/[email protected] : Trace - Setting cache key value store

2024-09-20T14:59:16.062Z 6dcfe0e2-2658-48d3-870a-ff75914238b2 INFO Level: 4 Message: [Fri, 20 Sep 2024 14:59:16 GMT] : [] : @azure/[email protected] : Trace - Getting cache key-value store

2024-09-20T14:59:16.062Z 6dcfe0e2-2658-48d3-870a-ff75914238b2 INFO kvStore: {}

2024-09-20T14:59:16.062Z 6dcfe0e2-2658-48d3-870a-ff75914238b2 INFO accountEntities: []

After another tests the functionality of the removeAccount is correct. But, after:

{A13BD7A7-DE71-481D-9D5B-3BC5C3966F63}

The afterCacheAccess in DistributedCachePlugin is called and the result of kvStore is {} and the accountEntities is []. So, in this moment i dont have my partition key to make the new input. I gonna this use the partitionManager.getKey() to make the the updated if !accountEntities.length

@LuccaRebelloToledo
Copy link
Author

I identified the problem. I'll write the pull request with the fix :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-unconfirmed A reported bug that needs to be investigated and confirmed confidential-client Issues regarding ConfidentialClientApplications msal-node Related to msal-node package Needs: Attention 👋 Awaiting response from the MSAL.js team question Customer is asking for a clarification, use case or information.
Projects
None yet
Development

No branches or pull requests

1 participant