Skip to content

Commit fcdb1f8

Browse files
committed
Fix: Login for browsers blocking third party cookies (2)
Related: 87be725
1 parent 0591977 commit fcdb1f8

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/conversation-ui/src/Utils.jsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,6 @@ const getIdToken = async (account, instance) => {
5050
return res.idToken;
5151
})
5252
.catch((error) => {
53-
if (!(error instanceof InteractionRequiredAuthError)) {
54-
console.error(error);
55-
return null;
56-
}
57-
5853
const onSuccess = (res) => {
5954
return res.idToken;
6055
};
@@ -64,8 +59,13 @@ const getIdToken = async (account, instance) => {
6459
return null;
6560
};
6661

67-
// Failback to popup
68-
return instance.acquireTokenPopup(req).then(onSuccess).catch(onError);
62+
if (!(error instanceof InteractionRequiredAuthError)) {
63+
return onError(error);
64+
}
65+
66+
// Browsers are increasingly blocking third party cookies by default. Detect that option is combersome. Thus, we always use redirect instead of popup.
67+
// See: https://github.com/AzureAD/microsoft-authentication-library-for-js/issues/3118#issuecomment-1655932572
68+
return instance.acquireTokenRedirect(req).then(onSuccess).catch(onError);
6969
});
7070

7171
return idToken;

0 commit comments

Comments
 (0)