Reputation: 161
Iam using msal 1.3.1 and i observe popup flow works fine for me, whereas redirect flow doesn't work.
My code looks like below, All prerequisites are taken care as popup flow works fine.
if (redirect) {
msalApp.handleRedirectCallback(() => {(tokenRes : AuthResponse) =>{
alert(tokenRes.accessToken);
}});
return msalApp.loginRedirect({
...GRAPH_REQUESTS.APP,
redirectUri: "http://localhost:3008"
});
}
The issue is that it append idtoken to the url and loads forever,
Upvotes: 1
Views: 2183
Reputation: 541
I'd try to look in the msal interceptor. Copy paste the code from the version you're using in Github and debug from there.
Acquire tokens might not be working as expected. Or, you might need to set the storeAuthStateInCookie to true for IE.
Upvotes: 0
Reputation: 2447
I have tested in my environment with MSAL 1.3.1 and working fine for me. This error may occur if redirect URLs are not same. The possibility would be the confusion between using of http and https which are not treated as same URL in azure app registration. In your Azure portal app registration check if you have used "HTTP" or "HTTPS" for the redirect URL and update accordingly. For example if it is HTTPS change it in your code also to use HTTPS. It will fix the issue.
Upvotes: 2
Reputation: 934
Did you look into MSAL React Sample Application built by Microsoft?
Url: https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/react-sample-app
Important especially for you: https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/samples/react-sample-app/src/AuthProvider.js
Those samples show support for both popup and redirect flows (for IE or other older browsers). You don't need to include code for both if you don't need support for both flows.
Upvotes: 1