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

aadTokenProviderFactory getToken gives the previous user's token on Firefox #10030

Open
1 of 9 tasks
Bux42 opened this issue Nov 25, 2024 · 0 comments
Open
1 of 9 tasks
Labels
type:bug-suspected Suspected bug (not working as designed/expected). See “type:bug-confirmed” for confirmed bugs.

Comments

@Bux42
Copy link

Bux42 commented Nov 25, 2024

Target SharePoint environment

SharePoint Online

What SharePoint development model, framework, SDK or API is this about?

💥 SharePoint Framework

Developer environment

Windows

What browser(s) / client(s) have you tested

  • 💥 Internet Explorer
  • 💥 Microsoft Edge
  • 💥 Google Chrome
  • 💥 FireFox
  • 💥 Safari
  • mobile (iOS/iPadOS)
  • mobile (Android)
  • not applicable
  • other (enter in the "Additional environment details" area below)

Additional environment details

  • Firefox 132.0.2 (64 bits)
  • SPFx version: tested on both 1.18.2 and 1.20.0
  • Node.js 18.18.2

Describe the bug / error

On Firefox, and Firefox only (Chrome, Edge etc do not have this issue), when switching accounts on SharePoint Online, the token provided by the following code:

const tokenProvider =  await this.context.aadTokenProviderFactory.getTokenProvider();
const tokenBase64 = await tokenProvider.getToken(
    "https://graph.microsoft.com"
);

const jsonToken = jwtDecode(tokenBase64);

stays the same.

If I browse SharePoint with user A, then switch to user B, the token retrieved from the code above will be user A's token.

I made a basic Webpart project with a console.log() of the token at: https://github.com/Bux42/SPFX_Aad_Token_Bug for ease of reproduction. Here is where I get and log the token.

Steps to reproduce

  1. Create a new Webpart project (I made one here just for this bug: https://github.com/Bux42/SPFX_Aad_Token_Bug )
  2. In the code, call and console.log() the token
  3. Using Firefox, go on SharePoint in debug mode, on any page (you must be connected)
  4. Check the token
  5. Switch accounts in SharePoint
  6. Check the token again, it will be the token from the previously connected account

Expected behavior

Using Firefox, after switching from account A to account B on SharePoint, the code above will give user B's token

@Bux42 Bux42 added the type:bug-suspected Suspected bug (not working as designed/expected). See “type:bug-confirmed” for confirmed bugs. label Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug-suspected Suspected bug (not working as designed/expected). See “type:bug-confirmed” for confirmed bugs.
Projects
None yet
Development

No branches or pull requests

1 participant