Core Library
MSAL.js (@azure/msal-browser)
Core Library Version
5.6.3
Wrapper Library
MSAL React (@azure/msal-react)
Wrapper Library Version
5.2.1
Public or Confidential Client?
Public
Description
Hi,
I'm having an issue with the login flow, I'm working on a Next.js app (v 16.2.0) using PublicClientApplication.
Everything works fine on the local dev server but once I build and deploy the behaviour changes: no matter what I try I always end up getting this error as soon as I land on the page and the redirect never happes:
0t69r74~xfe4z.js:1 Uncaught (in promise) BrowserAuthError: no_token_request_cache_error: See https://aka.ms/msal.js.errors#no_token_request_cache_error for details
at 0t69r74~xfe4z.js:1:156328
at t$.getCachedRequest (0t69r74~xfe4z.js:1:273717)
at nd.handleRedirectPromiseInternal (0t69r74~xfe4z.js:1:385821)
at nd.handleRedirectPromise (0t69r74~xfe4z.js:1:384451)
at Object.handleRedirectPromise (0t69r74~xfe4z.js:1:414248)
at 0t69r74~xfe4z.js:37:168382
I only have the root page (/) and I want to redirect the user to the login page as soon as he lands, the general structure looks like this:
<RootLayout>
<Providers>
<MsalProvider>
<AuthGuard>
<AuthenticatedTemplate>{...}</AuthenticatedTemplate>
<UnauthenticatedTemplate>{...}</UnauthenticatedTemplate>
</AuthGuard>
</MsalProvider>
</Providers>
</RootLayout>
The majority of the componets are client components (Providers, AuthGuard and all of their childrens).
The msalInstance that I'm passing to MsalProvider is initialized at module-level inside the Providers component, but I've also tried initializing it outside of that module.
Inside AuthGuard I'm invoking the login redirect like so
const { instance, inProgress } = useMsal();
const isAuthenticated = useIsAuthenticated();
useEffect(() => {
// Only redirect if no interaction is in progress and user is not logged in
if (!isAuthenticated && inProgress === InteractionStatus.None) {
instance.loginRedirect();
}
}, [isAuthenticated, inProgress, instance]);
But I've really tried everything, I've tried with useMsalAuthentication(), I've tried moving the msalInstance initialization both inside and outside MsalProvider, I've tried manually calling initialize(), I've tried making the msalInstance instance into a singleton and many other changes that I can't even remember, the end result is always the same: no_token_request_cache_error.
I could explain more aspects about how I deploy the app but I think those are not relevant since this problem also happens when running the built version locally.
I've tried to add every relevant information I could, let me know if there's something I've missed.
Error Message
Uncaught (in promise) BrowserAuthError: no_token_request_cache_error: See https://aka.ms/msal.js.errors#no_token_request_cache_error for details
at (...)
at t$.getCachedRequest (...)
at nd.handleRedirectPromiseInternal (...)
at nd.handleRedirectPromise (...)
at Object.handleRedirectPromise (...)
at (...)
MSAL Logs
[MSAL][Trace] [Tue, 14 Apr 2026 14:18:17 GMT] : [019d8c5b-7746-7ed2-9c95-25e486e8f2b4] : @azure/msal-browser@5.6.3 : Trace - 1f7joy
[MSAL][Trace] [Tue, 14 Apr 2026 14:18:17 GMT] : [019d8c5b-7746-7ed2-9c95-25e486e8f2b4] : @azure/msal-browser@5.6.3 : Trace - 1plfzx
[MSAL][Info] [Tue, 14 Apr 2026 14:18:17 GMT] : [019d8c5b-7746-7ed2-9c95-25e486e8f2b4] : @azure/msal-browser@5.6.3 : Info - 1wuc87
[MSAL][Trace] [Tue, 14 Apr 2026 14:18:17 GMT] : [019d8c5b-7746-7ed2-9c95-25e486e8f2b4] : @azure/msal-browser@5.6.3 : Trace - 1g8n6a
[MSAL][Verbose] [Tue, 14 Apr 2026 14:18:17 GMT] : [] : @azure/msal-browser@5.6.3 : Verbose - 02l8bm
[MSAL][Trace] [Tue, 14 Apr 2026 14:18:17 GMT] : [] : @azure/msal-browser@5.6.3 : Trace - 1qhy81
[MSAL][Trace] [Tue, 14 Apr 2026 14:18:17 GMT] : [] : @azure/msal-browser@5.6.3 : Trace - 1qhy81
[MSAL][Verbose] [Tue, 14 Apr 2026 14:18:17 GMT] : [019d8c5b-774e-76c6-9546-bd41503fa074] : @azure/msal-browser@5.6.3 : Verbose - 1yd030
[MSAL][Trace] [Tue, 14 Apr 2026 14:18:17 GMT] : [] : @azure/msal-browser@5.6.3 : Trace - 1yxcdm
[MSAL][Trace] [Tue, 14 Apr 2026 14:18:17 GMT] : [] : @azure/msal-browser@5.6.3 : Trace - 1qhy81
[MSAL][Trace] [Tue, 14 Apr 2026 14:18:17 GMT] : [] : @azure/msal-browser@5.6.3 : Trace - 0mnxd4
[MSAL][Trace] [Tue, 14 Apr 2026 14:18:17 GMT] : [] : @azure/msal-browser@5.6.3 : Trace - 0uen20
[MSAL][Trace] [Tue, 14 Apr 2026 14:18:17 GMT] : [] : @azure/msal-browser@5.6.3 : Trace - 1qhy81
[MSAL][Trace] [Tue, 14 Apr 2026 14:18:17 GMT] : [] : @azure/msal-browser@5.6.3 : Trace - 0h0ynu
[MSAL][Trace] [Tue, 14 Apr 2026 14:18:17 GMT] : [] : @azure/msal-browser@5.6.3 : Trace - 1qhy81
[MSAL][Verbose] [Tue, 14 Apr 2026 14:18:17 GMT] : [] : @azure/msal-browser@5.6.3 : Verbose - 1wn9kp
Network Trace (Preferrably Fiddler)
MSAL Configuration
{
auth: {
clientId,
authority: `https://login.microsoftonline.com/${tenantId}`,
redirectUri: process.env.NEXT_PUBLIC_AUTH_URL,
},
cache: {
cacheLocation: "sessionStorage",
},
system: {
loggerOptions: {
logLevel: LogLevel.Trace,
loggerCallback: (level, message, containsPii) => {
if (containsPii) return;
console.log(`[MSAL][${LogLevel[level]}] ${message}`);
},
},
},
}
Relevant Code Snippets
const { instance, inProgress } = useMsal();
const isAuthenticated = useIsAuthenticated();
useEffect(() => {
// Only redirect if no interaction is in progress and user is not logged in
if (!isAuthenticated && inProgress === InteractionStatus.None) {
instance.loginRedirect();
}
}, [isAuthenticated, inProgress, instance]);
Reproduction Steps
- Write the auth flow as described
- build the next js app (does not matter if standalone or not)
- start the built app
- open the browser, you will see the error.
Expected Behavior
The login redirect should happen without any errors.
Identity Provider
Entra ID (formerly Azure AD) / MSA
Browsers Affected (Select all that apply)
Chrome, Edge
Regression
No response
Core Library
MSAL.js (@azure/msal-browser)
Core Library Version
5.6.3
Wrapper Library
MSAL React (@azure/msal-react)
Wrapper Library Version
5.2.1
Public or Confidential Client?
Public
Description
Hi,
I'm having an issue with the login flow, I'm working on a Next.js app (v 16.2.0) using
PublicClientApplication.Everything works fine on the local dev server but once I build and deploy the behaviour changes: no matter what I try I always end up getting this error as soon as I land on the page and the redirect never happes:
I only have the root page (
/) and I want to redirect the user to the login page as soon as he lands, the general structure looks like this:The majority of the componets are client components (Providers, AuthGuard and all of their childrens).
The
msalInstancethat I'm passing toMsalProvideris initialized at module-level inside theProviderscomponent, but I've also tried initializing it outside of that module.Inside
AuthGuardI'm invoking the login redirect like soBut I've really tried everything, I've tried with
useMsalAuthentication(), I've tried moving the msalInstance initialization both inside and outsideMsalProvider, I've tried manually callinginitialize(), I've tried making the msalInstance instance into a singleton and many other changes that I can't even remember, the end result is always the same:no_token_request_cache_error.I could explain more aspects about how I deploy the app but I think those are not relevant since this problem also happens when running the built version locally.
I've tried to add every relevant information I could, let me know if there's something I've missed.
Error Message
Uncaught (in promise) BrowserAuthError: no_token_request_cache_error: See https://aka.ms/msal.js.errors#no_token_request_cache_error for details
at (...)
at t$.getCachedRequest (...)
at nd.handleRedirectPromiseInternal (...)
at nd.handleRedirectPromise (...)
at Object.handleRedirectPromise (...)
at (...)
MSAL Logs
[MSAL][Trace] [Tue, 14 Apr 2026 14:18:17 GMT] : [019d8c5b-7746-7ed2-9c95-25e486e8f2b4] : @azure/msal-browser@5.6.3 : Trace - 1f7joy
[MSAL][Trace] [Tue, 14 Apr 2026 14:18:17 GMT] : [019d8c5b-7746-7ed2-9c95-25e486e8f2b4] : @azure/msal-browser@5.6.3 : Trace - 1plfzx
[MSAL][Info] [Tue, 14 Apr 2026 14:18:17 GMT] : [019d8c5b-7746-7ed2-9c95-25e486e8f2b4] : @azure/msal-browser@5.6.3 : Info - 1wuc87
[MSAL][Trace] [Tue, 14 Apr 2026 14:18:17 GMT] : [019d8c5b-7746-7ed2-9c95-25e486e8f2b4] : @azure/msal-browser@5.6.3 : Trace - 1g8n6a
[MSAL][Verbose] [Tue, 14 Apr 2026 14:18:17 GMT] : [] : @azure/msal-browser@5.6.3 : Verbose - 02l8bm
[MSAL][Trace] [Tue, 14 Apr 2026 14:18:17 GMT] : [] : @azure/msal-browser@5.6.3 : Trace - 1qhy81
[MSAL][Trace] [Tue, 14 Apr 2026 14:18:17 GMT] : [] : @azure/msal-browser@5.6.3 : Trace - 1qhy81
[MSAL][Verbose] [Tue, 14 Apr 2026 14:18:17 GMT] : [019d8c5b-774e-76c6-9546-bd41503fa074] : @azure/msal-browser@5.6.3 : Verbose - 1yd030
[MSAL][Trace] [Tue, 14 Apr 2026 14:18:17 GMT] : [] : @azure/msal-browser@5.6.3 : Trace - 1yxcdm
[MSAL][Trace] [Tue, 14 Apr 2026 14:18:17 GMT] : [] : @azure/msal-browser@5.6.3 : Trace - 1qhy81
[MSAL][Trace] [Tue, 14 Apr 2026 14:18:17 GMT] : [] : @azure/msal-browser@5.6.3 : Trace - 0mnxd4
[MSAL][Trace] [Tue, 14 Apr 2026 14:18:17 GMT] : [] : @azure/msal-browser@5.6.3 : Trace - 0uen20
[MSAL][Trace] [Tue, 14 Apr 2026 14:18:17 GMT] : [] : @azure/msal-browser@5.6.3 : Trace - 1qhy81
[MSAL][Trace] [Tue, 14 Apr 2026 14:18:17 GMT] : [] : @azure/msal-browser@5.6.3 : Trace - 0h0ynu
[MSAL][Trace] [Tue, 14 Apr 2026 14:18:17 GMT] : [] : @azure/msal-browser@5.6.3 : Trace - 1qhy81
[MSAL][Verbose] [Tue, 14 Apr 2026 14:18:17 GMT] : [] : @azure/msal-browser@5.6.3 : Verbose - 1wn9kp
Network Trace (Preferrably Fiddler)
MSAL Configuration
Relevant Code Snippets
Reproduction Steps
Expected Behavior
The login redirect should happen without any errors.
Identity Provider
Entra ID (formerly Azure AD) / MSA
Browsers Affected (Select all that apply)
Chrome, Edge
Regression
No response