Reload During Mounting
I am trying to load a few components conditionally. Here is the code snippet.
I expect the above code to show
<NuxtPage />
when the user is logged in and the error component only when the user is unauthorized. But, when we load the app for the first time by visiting localhost:3000, it briefly shows the error component and then refreshes to show the NuxtPage. I am not able to figure out what's wrong with the code. Any help will be highly appreciated.
PS. The login system is using Microsoft Authentication Library (MSAL). getToken
fetches a token and saves it in AuthStore which is then fetched using useAuthStore
. MSAL works by redirecting to a Microsoft Authentication Portal and then if the token is already present for the user (already signed in), redirects back to the site, or if the token is not already present then keeps the user on its authentication portal until the user completes signing in.5 Replies
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Thanks for the response Chris. Here is what
getToken
and signIn
methods contain.
I tried with the code snipped that you've suggested @chris.foss but the problem persists.Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Thanks for taking another look @chris.foss . I tried making
handleResponse
async
and await
ing handleResponse
and $msal.loginRedirect
. But the problem still persists.Unknown User•2y ago
Message Not Public
Sign In & Join Server To View