Skip to content

Revoked ATs are returned after re-login #335

@jiasli

Description

@jiasli

Describe the bug

Revoked ATs are returned after re-login.

To Reproduce

  1. Log in with auth code flow with organizations tenant and https://management.core.windows.net/ resource.

  2. Get an AT explicitly with tenant ID 54826b22-38d6-4fb2-bad9-b7b93a3e9c5a.

    At this point, in token cache the AccessToken contains 2 entries:

    • AT1: 14387eca3-bb26-4047-922a-6452cae1e9c7.54826b22-38d6-4fb2-bad9-b7b93a3e9c5a-login.microsoftonline.com-accesstoken-04b07795-8ddb-461a-bbee-02f9e1bf7b46-organizations-https://management.core.windows.net//user_impersonation https://management.core.windows.net//.default
    • AT2: 4387eca3-bb26-4047-922a-6452cae1e9c7.54826b22-38d6-4fb2-bad9-b7b93a3e9c5a-login.microsoftonline.com-accesstoken-04b07795-8ddb-461a-bbee-02f9e1bf7b46-54826b22-38d6-4fb2-bad9-b7b93a3e9c5a-https://management.core.windows.net//user_impersonation https://management.core.windows.net//.default
  3. Revoke the session with

    az rest -m POST -u https://graph.microsoft.com/v1.0/me/revokeSignInSessions
    

    Doing so adds a new AT for https://graph.microsoft.com/:

    • AT3: 4387eca3-bb26-4047-922a-6452cae1e9c7.54826b22-38d6-4fb2-bad9-b7b93a3e9c5a-login.microsoftonline.com-accesstoken-04b07795-8ddb-461a-bbee-02f9e1bf7b46-54826b22-38d6-4fb2-bad9-b7b93a3e9c5a-email openid profile https://graph.microsoft.com//auditlog.read.all https://graph.microsoft.com//directory.accessasuser.all https://graph.microsoft.com//group.readwrite.all https://graph.microsoft.com//user.readwrite.all https://graph.microsoft.com//.default
  4. Re-login with auth code flow with organizations.

    At this point, in token cache the AccessToken contains 3 entries and only AT1 is updated:

    • AT1 (Updated): 14387eca3-bb26-4047-922a-6452cae1e9c7.54826b22-38d6-4fb2-bad9-b7b93a3e9c5a-login.microsoftonline.com-accesstoken-04b07795-8ddb-461a-bbee-02f9e1bf7b46-organizations-https://management.core.windows.net//user_impersonation https://management.core.windows.net//.default
    • AT2 (Old): 4387eca3-bb26-4047-922a-6452cae1e9c7.54826b22-38d6-4fb2-bad9-b7b93a3e9c5a-login.microsoftonline.com-accesstoken-04b07795-8ddb-461a-bbee-02f9e1bf7b46-54826b22-38d6-4fb2-bad9-b7b93a3e9c5a-https://management.core.windows.net//user_impersonation https://management.core.windows.net//.default
    • AT3 (Old): 4387eca3-bb26-4047-922a-6452cae1e9c7.54826b22-38d6-4fb2-bad9-b7b93a3e9c5a-login.microsoftonline.com-accesstoken-04b07795-8ddb-461a-bbee-02f9e1bf7b46-54826b22-38d6-4fb2-bad9-b7b93a3e9c5a-email openid profile https://graph.microsoft.com//auditlog.read.all https://graph.microsoft.com//directory.accessasuser.all https://graph.microsoft.com//group.readwrite.all https://graph.microsoft.com//user.readwrite.all https://graph.microsoft.com//.default
  5. Get an AT explicitly with tenant ID 54826b22-38d6-4fb2-bad9-b7b93a3e9c5a -> the old revoked AT2 is returned

  6. Use AT2 with ARM -> ❌

Expected behavior

MSAL should purge all ATs if RT is updated for this user.

What you see instead

Old ATs are still preserved and returned by MSAL.

The MSAL Python version you are using

1.10.0

Additional context

To solve this issue I have to manually delete the MSAL cache to get all ATs purged.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions