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

React on Azure static web app token does not persist on refresh #7261

Open
1 of 2 tasks
sander110419 opened this issue Aug 19, 2024 · 0 comments
Open
1 of 2 tasks

React on Azure static web app token does not persist on refresh #7261

sander110419 opened this issue Aug 19, 2024 · 0 comments
Labels
b2c Related to Azure B2C library-specific issues bug-unconfirmed A reported bug that needs to be investigated and confirmed msal-node Related to msal-node package msal-react Related to @azure/msal-react Needs: Attention 👋 Awaiting response from the MSAL.js team public-client Issues regarding PublicClientApplications question Customer is asking for a clarification, use case or information.

Comments

@sander110419
Copy link

Core Library

MSAL Node (@azure/msal-node)

Core Library Version

3.1.0

Wrapper Library

MSAL React (@azure/msal-react)

Wrapper Library Version

2.0.3

Public or Confidential Client?

Public

Description

I deploy a react application to an Azure static web app.

If I run my app locally (redirectUri etc to "/"), the token is reused correctly when I refresh the page.
If I deploy my app as a astatic web app and I refresh the page, my token returns "undefined" When moving between pages the token keeps working, it's just gone as soon as I refresh.

Error Message

No response

MSAL Logs

[Mon, 19 Aug 2024 14:03:54 GMT] : [] : @azure/msal-browser@3.21.0 : Verbose - BrowserCrypto: modern crypto interface available
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [] : @azure/msal-browser@3.21.0 : Verbose - BrowserCacheManager:createKeyMaps - account and token key maps already exist, skipping migration.
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [] : @azure/msal-browser@3.21.0 : Verbose - BrowserCrypto: modern crypto interface available
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [] : @azure/msal-browser@3.21.0 : Verbose - BrowserCacheManager:createKeyMaps - account and token key maps already exist, skipping migration.
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [] : @azure/msal-browser@3.21.0 : Info - Emitting event: msal:initializeStart
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [] : @azure/msal-browser@3.21.0 : Verbose - Claims-based caching is disabled. Clearing the previous cache with claims
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [] : @azure/msal-browser@3.21.0 : Info - Emitting event: msal:initializeEnd
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [] : @azure/msal-common@14.14.1 : Info - CacheManager:getIdToken - No token found
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [] : @azure/msal-browser@3.21.0 : Verbose - Adding account storage listener.
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [] : @azure/msal-browser@3.21.0 : Verbose - Event callback registered with id: 01916af3-9719-7454-87f0-99b87203a06c
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [] : @azure/msal-browser@3.21.0 : Verbose - getAllAccounts called
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [] : @azure/msal-common@14.14.1 : Info - CacheManager:getIdToken - No token found
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [] : @azure/msal-common@14.14.1 : Info - CacheManager:getIdToken - No token found
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [] : @azure/msal-common@14.14.1 : Info - CacheManager:getIdToken - No token found
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [] : @azure/msal-common@14.14.1 : Info - CacheManager:getIdToken - No token found
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [] : @azure/msal-common@14.14.1 : Info - CacheManager:getIdToken - No token found
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [] : @azure/msal-common@14.14.1 : Info - CacheManager:getIdToken - No token found
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [] : @azure/msal-browser@3.21.0 : Verbose - Event callback registered with id: 01916af3-97ce-7dfe-bf16-b76a0ea4610a
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [] : @azure/msal-react@2.0.22 : Verbose - useMsalAuthentication - Registered event callback with id: 01916af3-97ce-7dfe-bf16-b76a0ea4610a
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [] : @azure/msal-browser@3.21.0 : Verbose - Event callback registered with id: 01916af3-97ce-774f-9fc7-37f25eff70b9
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [] : @azure/msal-browser@3.21.0 : Verbose - Event callback registered with id: 01916af3-97ce-72e2-b4d3-a9dab4505e71
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [] : @azure/msal-react@2.0.22 : Verbose - MsalProvider - Registered event callback with id: 01916af3-97ce-72e2-b4d3-a9dab4505e71
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [] : @azure/msal-browser@3.21.0 : Info - initialize has already been called, exiting early.
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [] : @azure/msal-common@14.14.1 : Info - CacheManager:getIdToken - No token found
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [] : @azure/msal-common@14.14.1 : Info - CacheManager:getIdToken - No token found
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [] : @azure/msal-browser@3.21.0 : Verbose - handleRedirectPromise called
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [] : @azure/msal-browser@3.21.0 : Verbose - getAllAccounts called
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [] : @azure/msal-common@14.14.1 : Info - CacheManager:getIdToken - No token found
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [] : @azure/msal-browser@3.21.0 : Info - Emitting event: msal:handleRedirectStart
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [] : @azure/msal-browser@3.21.0 : Verbose - Emitting event to callback 01916af3-9719-7454-87f0-99b87203a06c: msal:handleRedirectStart
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [] : @azure/msal-browser@3.21.0 : Verbose - Emitting event to callback 01916af3-97ce-7dfe-bf16-b76a0ea4610a: msal:handleRedirectStart
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [] : @azure/msal-browser@3.21.0 : Verbose - Emitting event to callback 01916af3-97ce-774f-9fc7-37f25eff70b9: msal:handleRedirectStart
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [] : @azure/msal-browser@3.21.0 : Verbose - Emitting event to callback 01916af3-97ce-72e2-b4d3-a9dab4505e71: msal:handleRedirectStart
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [01916af3-97d3-7f05-a796-fca925cf3b28] : msal.js.browser@3.21.0 : Verbose - initializeServerTelemetryManager called
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [01916af3-97d3-7f05-a796-fca925cf3b28] : msal.js.browser@3.21.0 : Info - handleRedirectPromise called but there is no interaction in progress, returning null.
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [] : @azure/msal-browser@3.21.0 : Verbose - handleRedirectPromise has been called for the first time, storing the promise
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [] : @azure/msal-browser@3.21.0 : Info - Emitting event: msal:handleRedirectEnd
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [] : @azure/msal-browser@3.21.0 : Verbose - Emitting event to callback 01916af3-9719-7454-87f0-99b87203a06c: msal:handleRedirectEnd
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [] : @azure/msal-browser@3.21.0 : Verbose - Emitting event to callback 01916af3-97ce-7dfe-bf16-b76a0ea4610a: msal:handleRedirectEnd
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [] : @azure/msal-browser@3.21.0 : Verbose - Emitting event to callback 01916af3-97ce-774f-9fc7-37f25eff70b9: msal:handleRedirectEnd
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [] : @azure/msal-browser@3.21.0 : Verbose - Emitting event to callback 01916af3-97ce-72e2-b4d3-a9dab4505e71: msal:handleRedirectEnd
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [] : @azure/msal-react@2.0.22 : Info - MsalProvider - msal:handleRedirectStart results in setting inProgress from startup to handleRedirect
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [] : @azure/msal-browser@3.21.0 : Verbose - getAllAccounts called
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [] : @azure/msal-common@14.14.1 : Info - CacheManager:getIdToken - No token found
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [] : @azure/msal-react@2.0.22 : Info - MsalProvider - msal:handleRedirectEnd results in setting inProgress from handleRedirect to none
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [] : @azure/msal-browser@3.21.0 : Verbose - getAllAccounts called
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [] : @azure/msal-common@14.14.1 : Info - CacheManager:getIdToken - No token found
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [] : @azure/msal-browser@3.21.0 : Verbose - getAllAccounts called
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [] : @azure/msal-common@14.14.1 : Info - CacheManager:getIdToken - No token found
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [] : @azure/msal-common@14.14.1 : Info - CacheManager:getIdToken - No token found
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [] : @azure/msal-common@14.14.1 : Info - CacheManager:getIdToken - No token found
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [] : @azure/msal-common@14.14.1 : Info - CacheManager:getIdToken - No token found
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [] : @azure/msal-common@14.14.1 : Info - CacheManager:getIdToken - No token found
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [] : @azure/msal-common@14.14.1 : Info - CacheManager:getIdToken - No token found
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [] : @azure/msal-common@14.14.1 : Info - CacheManager:getIdToken - No token found
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [] : @azure/msal-react@2.0.22 : Info - useMsalAuthentication - User is authenticated, attempting to acquire token
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [] : @azure/msal-react@2.0.22 : Verbose - useMsalAuthentication - Calling acquireTokenSilent
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [01916af3-97f2-7194-b1ba-3614558f83f0] : @azure/msal-browser@3.21.0 : Verbose - acquireTokenSilent called
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [01916af3-97f2-7194-b1ba-3614558f83f0] : @azure/msal-browser@3.21.0 : Verbose - acquireTokenSilent called for the first time, storing active request
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [] : @azure/msal-browser@3.21.0 : Info - Emitting event: msal:acquireTokenStart
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [] : @azure/msal-browser@3.21.0 : Verbose - Emitting event to callback 01916af3-9719-7454-87f0-99b87203a06c: msal:acquireTokenStart
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [] : @azure/msal-browser@3.21.0 : Verbose - Emitting event to callback 01916af3-97ce-7dfe-bf16-b76a0ea4610a: msal:acquireTokenStart
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [] : @azure/msal-browser@3.21.0 : Verbose - Emitting event to callback 01916af3-97ce-774f-9fc7-37f25eff70b9: msal:acquireTokenStart
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [] : @azure/msal-browser@3.21.0 : Verbose - Emitting event to callback 01916af3-97ce-72e2-b4d3-a9dab4505e71: msal:acquireTokenStart
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [] : @azure/msal-browser@3.21.0 : Verbose - Authentication Scheme wasn't explicitly set in request, defaulting to "Bearer" request
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [] : @azure/msal-browser@3.21.0 : Verbose - acquireTokenSilent - attempting to acquire token from web flow
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [01916af3-97f2-7194-b1ba-3614558f83f0] : msal.js.browser@3.21.0 : Verbose - initializeServerTelemetryManager called
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [01916af3-97f2-7194-b1ba-3614558f83f0] : msal.js.browser@3.21.0 : Verbose - Attempting to get cloud discovery metadata  from authority configuration
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [01916af3-97f2-7194-b1ba-3614558f83f0] : msal.js.browser@3.21.0 : Verbose - The host is included in knownAuthorities. Creating new cloud discovery metadata from the host.
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [01916af3-97f2-7194-b1ba-3614558f83f0] : msal.js.browser@3.21.0 : Verbose - Found cloud discovery metadata in authority configuration
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [01916af3-97f2-7194-b1ba-3614558f83f0] : msal.js.browser@3.21.0 : Verbose - Attempting to get endpoint metadata from authority configuration
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [01916af3-97f2-7194-b1ba-3614558f83f0] : msal.js.browser@3.21.0 : Verbose - Did not find endpoint metadata in the config... Attempting to get endpoint metadata from the hardcoded values.
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [01916af3-97f2-7194-b1ba-3614558f83f0] : msal.js.browser@3.21.0 : Verbose - Did not find endpoint metadata in hardcoded values... Attempting to get endpoint metadata from the network metadata cache.
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [01916af3-97f2-7194-b1ba-3614558f83f0] : msal.js.browser@3.21.0 : Verbose - Authority.getEndpointMetadataFromNetwork: attempting to retrieve OAuth endpoints from https://XXXXX.b2clogin.com/.onmicrosoft.com/XXXXXX/v2.0/.well-known/openid-configuration
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [] : @azure/msal-browser@3.21.0 : Verbose - getAllAccounts called
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [] : @azure/msal-common@14.14.1 : Info - CacheManager:getIdToken - No token found
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [] : @azure/msal-common@14.14.1 : Info - CacheManager:getIdToken - No token found
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [] : @azure/msal-common@14.14.1 : Info - CacheManager:getIdToken - No token found
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [] : @azure/msal-common@14.14.1 : Info - CacheManager:getIdToken - No token found
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [] : @azure/msal-common@14.14.1 : Info - CacheManager:getIdToken - No token found
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [01916af3-97f2-7194-b1ba-3614558f83f0] : msal.js.browser@3.21.0 : Verbose - Silent auth client created
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [] : @azure/msal-common@14.14.1 : Info - CacheManager:getAccessToken - No token found
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [] : @azure/msal-browser@3.21.0 : Info - Emitting event: msal:acquireTokenFromNetworkStart
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [] : @azure/msal-browser@3.21.0 : Verbose - Emitting event to callback 01916af3-9719-7454-87f0-99b87203a06c: msal:acquireTokenFromNetworkStart
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [] : @azure/msal-browser@3.21.0 : Verbose - Emitting event to callback 01916af3-97ce-7dfe-bf16-b76a0ea4610a: msal:acquireTokenFromNetworkStart
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [] : @azure/msal-browser@3.21.0 : Verbose - Emitting event to callback 01916af3-97ce-774f-9fc7-37f25eff70b9: msal:acquireTokenFromNetworkStart
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [] : @azure/msal-browser@3.21.0 : Verbose - Emitting event to callback 01916af3-97ce-72e2-b4d3-a9dab4505e71: msal:acquireTokenFromNetworkStart
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [01916af3-97f2-7194-b1ba-3614558f83f0] : msal.js.browser@3.21.0 : Verbose - Authentication Scheme set to "Bearer" as configured in Auth request
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [01916af3-97f2-7194-b1ba-3614558f83f0] : msal.js.browser@3.21.0 : Verbose - initializeServerTelemetryManager called
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [01916af3-97f2-7194-b1ba-3614558f83f0] : msal.js.browser@3.21.0 : Verbose - Attempting to get cloud discovery metadata  from authority configuration
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [01916af3-97f2-7194-b1ba-3614558f83f0] : msal.js.browser@3.21.0 : Verbose - The host is included in knownAuthorities. Creating new cloud discovery metadata from the host.
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [01916af3-97f2-7194-b1ba-3614558f83f0] : msal.js.browser@3.21.0 : Verbose - Found cloud discovery metadata in authority configuration
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [01916af3-97f2-7194-b1ba-3614558f83f0] : msal.js.browser@3.21.0 : Verbose - Attempting to get endpoint metadata from authority configuration
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [01916af3-97f2-7194-b1ba-3614558f83f0] : msal.js.browser@3.21.0 : Verbose - Did not find endpoint metadata in the config... Attempting to get endpoint metadata from the hardcoded values.
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [01916af3-97f2-7194-b1ba-3614558f83f0] : msal.js.browser@3.21.0 : Verbose - Did not find endpoint metadata in hardcoded values... Attempting to get endpoint metadata from the network metadata cache.
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [01916af3-97f2-7194-b1ba-3614558f83f0] : msal.js.browser@3.21.0 : Verbose - Found endpoint metadata in the cache.
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [] : @azure/msal-common@14.14.1 : Info - CacheManager:getRefreshToken - returning refresh token
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [] : @azure/msal-browser@3.21.0 : Verbose - getAllAccounts called
main.61123312.js:75 [Mon, 19 Aug 2024 14:03:54 GMT] : [] : @azure/msal-common@14.14.1 : Info - CacheManager:getIdToken - Returning ID token

Network Trace (Preferrably Fiddler)

  • Sent
  • Pending

MSAL Configuration

export const msalConfig = {
    auth: {
        clientId: "XXXXXXXXX",
        authority: b2cPolicies.authorities.signUpSignIn.authority,
        knownAuthorities: [b2cPolicies.authorityDomain],
        redirectUri: "https://XXXXX.azurestaticapps.net/",
        postLogoutRedirectUri: "https://XXXXXXXXX.azurestaticapps.net/"
        //redirectUri: "/",
        //postLogoutRedirectUri: "/"
    },
    cache: {
        cacheLocation: "localStorage",
        storeAuthStateInCookie: true
    },
    system: {
        allowNativeBroker: false,
    }
};

Relevant Code Snippets

import { LogLevel } from "@azure/msal-browser";
import { PublicClientApplication } from "@azure/msal-browser";

// Browser check variables
// If you support IE, our recommendation is that you sign-in using Redirect APIs
// If you as a developer are testing using Edge InPrivate mode, please add "isEdge" to the if check
const ua = window.navigator.userAgent;
const msie = ua.indexOf("MSIE ");
const msie11 = ua.indexOf("Trident/");
const msedge = ua.indexOf("Edge/");
const firefox = ua.indexOf("Firefox");

 export const b2cPolicies = {
    names: {
        signUpSignIn: "B2C_1_dev_XXXXXX",
        editProfile: "B2C_1_dev_XXXXXX"
    },
    authorities: {
        signUpSignIn: {
            authority: "https://XXXXXX.b2clogin.com/XXXXXX.onmicrosoft.com/B2C_1_dev_XXXXXX"
        },
        editProfile: {
            authority: "https://XXXXXX.b2clogin.com/XXXXXX.onmicrosoft.com/B2C_1_dev_XXXXXX"
        }
    },
    authorityDomain: "XXXXXX.b2clogin.com"
}

// Config object to be passed to Msal on creation
export const msalConfig = {
    auth: {
        clientId: "XXXXXX-XXXXXX",
        authority: b2cPolicies.authorities.signUpSignIn.authority,
        knownAuthorities: [b2cPolicies.authorityDomain],
        redirectUri: "https://XXXXXX.azurestaticapps.net/",
        postLogoutRedirectUri: "https://XXXXXX.azurestaticapps.net/"
    },
    cache: {
        cacheLocation: "localStorage",
        storeAuthStateInCookie: true
    },
    system: {
        loggerOptions: {
            logLevel: LogLevel.Trace,
            loggerCallback: (level, message, containsPii) => {
                if (containsPii) {
                    return;
                }
                switch (level) {
                    case LogLevel.Error:
                        console.error(message);
                        return;
                    case LogLevel.Info:
                        console.info(message);
                        return;
                    case LogLevel.Verbose:
                        console.debug(message);
                        return;
                    case LogLevel.Warning:
                        console.warn(message);
                        return;
                    default:
                        console.log(message);
                        return;
                }
            }
        }
    }
};
export const msalInstance = new PublicClientApplication(msalConfig);

export const loginRequest = {
};

export const apiConfig = {
};


### Reproduction Steps

Not sure if you can easily reproduce this, I'm willing to create credentials for you to see it on the site, the code added in the relevant Code Snippets is the entire authConfig.js

### Expected Behavior

Tokens should stay in localStorage on refresh and not removed when the page is refreshed.

### Identity Provider

Azure B2C Basic Policy

### Browsers Affected (Select all that apply)

Chrome, Edge

### Regression

_No response_

### Source

External (Customer)
@sander110419 sander110419 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 Aug 19, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs: Attention 👋 Awaiting response from the MSAL.js team label Aug 19, 2024
@github-actions github-actions bot added b2c Related to Azure B2C library-specific issues msal-node Related to msal-node package msal-react Related to @azure/msal-react public-client Issues regarding PublicClientApplications labels Aug 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
b2c Related to Azure B2C library-specific issues bug-unconfirmed A reported bug that needs to be investigated and confirmed msal-node Related to msal-node package msal-react Related to @azure/msal-react Needs: Attention 👋 Awaiting response from the MSAL.js team public-client Issues regarding PublicClientApplications question Customer is asking for a clarification, use case or information.
Projects
None yet
Development

No branches or pull requests

1 participant