Questions tagged [msal-react]
113 questions
9
votes
2 answers
Mocking authentication when testing MSAL React Apps
Our app is wrapped in the MSAL Authentication Template from @azure/msal-react in a standard way - key code segments are summarized below.
We would like to test app's individual components using react testing library (or something similar). Of…

savreline
- 131
- 1
- 7
6
votes
2 answers
Microsoft Authentication React "hash_empty_error" when using loginPopup
I am failing to understand the error that I am getting while trying to authenticate a user with the Micrsoft Authentication library for React (PWA). I need help understanding why it fails when attempting to sign in a user using the loginPopup…

0xdeadbeef
- 101
- 1
- 5
5
votes
0 answers
How to server side render using Next.js and MSAL?
Right now, I am using a MsalProvider to authenticate a user based on the Microsoft account they are signed in with. And three things happen when a component mounts:
The app obtains a token from MSAL using @azure/msal-react
Use this token to call an…

aayani
- 333
- 9
- 19
3
votes
3 answers
Redirect un-authenicated users to Landing/Login page
I'm trying to create a react SPA, using AzureAD/MSAL for authentication. I have a Landing page at / with a Login button and a separate app Home page on a /home route. If someone tries to navigate directly to /home without authenticating, I want to…

RaGe
- 22,696
- 11
- 72
- 104
3
votes
1 answer
Bypass the account selection screen while sign out(log out) @azure/msal-angular V2
I am using the @azure/msal-angular version 2 and Angular version 13. The scenario is when the user signed in to the application need to authorize the user if he doesn't have access need to sign out the user from the application. which will be…

prem_kumar
- 124
- 1
- 10
3
votes
1 answer
How to trigger an session expired popup after ten minutes using @msal - react and azure ad
Auth Provider : Azure Active Directory
Client library : @azure/msal-react
As explained here my msal token expires after one hour MSAL token expires after 1 hour, My requirement is I would like to configure a session time of 15 minutes ( or 10…

Deepak Kothari
- 1,601
- 24
- 31
2
votes
3 answers
Refresh access token automatically
For my site, I added a simple authorization page through microsoft (using the @azure/msal-react library).
You can check out the demo version at the link https://codesandbox.io/s/wizardly-williams-j4bo42
After successful registration, the user is…

Paul
- 53
- 3
- 21
2
votes
1 answer
MSAL Auth stores authentication information in local storage - How to limit storage of information
I am working on a single page application (SPA) app that grants access to specific paths in the application, based on roles setup in Azure AD for the user logging in. As per this…

Skadoosh
- 699
- 2
- 11
- 27
2
votes
2 answers
MSAL all tenants sign on with pop up redirects inside popup
I used the MSAL quickstart for react - creating a single tenant app registration for a SPA. The react code worked with the pop up meaning a user could sign in and the pop up went away.
Now I need to move from single tenant to multi-tenant with the…

DFBerry
- 1,818
- 1
- 19
- 37
2
votes
1 answer
Verifying Token from MSAL-React on Backend
I'm currently working on a project that has a frontend built with React and is using authentication from Azure AD. I'm using the MSAL-React package on the frontend to handle login.
When a user makes an API request to the backend, I want them to send…

Devon S.
- 21
- 2
2
votes
0 answers
Jest Unit test is failing for @microsoft/mgt-components even after adding the node_module to transformIgnorePatterns
I am using Microsoft authentication within my App to enable users to login. The flow itself is working seamlessly but the unit test is failing. I have added @microsoft to the transformIgnorePatterns property but seems like it is still not being…

hushie
- 417
- 10
- 23
2
votes
0 answers
React MSAL not working after page refresh
I am using @azure/msal-react and @azure/msal-browser for authentication in our application. So far i have intialized a msal instance and used it to acquire a token and fetch the alias. Everything works until i do a page refresh i want to understand…

ash1102
- 409
- 4
- 20
2
votes
2 answers
@azure/msal-browser untrusted_authority error
I've been trying to follow this tutorial...
Sign In Users From A React SPA
but I cannot get it to work. I have a personal azure account and have created an SPA application within Azure Active Directory to get a client id.
From everything I've read…

jdez
- 57
- 1
- 7
2
votes
0 answers
Can MSAL-react handle manually setting an access token, to log us in?
Our app uses Authorization Code Flow with PKCE which is implemented using the MSAL-React package https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/lib/msal-reactand which runs on the Azure B2C Active Directory.
We currently…

billionsOfYearz
- 21
- 2
2
votes
0 answers
loginPopup does not redirect to redirectUri in the original tab but opens redirectUri on Popup in D365
I'm using MSAL in a react based SPA and a PCF component which is imported into a canvas app and this canvas app is embedded into Dynamic365 Field service CRM.
I have created a Azure AAD app registration and added these redirectUri in Single Page…

Dhruvil Dave
- 109
- 1
- 20