Skip to content

Commit

Permalink
Fix: Login for browsers blocking third party cookies (2)
Browse files Browse the repository at this point in the history
Related: 87be725
  • Loading branch information
clemlesne committed Aug 2, 2023
1 parent 0591977 commit fcdb1f8
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/conversation-ui/src/Utils.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,6 @@ const getIdToken = async (account, instance) => {
return res.idToken;
})
.catch((error) => {
if (!(error instanceof InteractionRequiredAuthError)) {
console.error(error);
return null;
}

const onSuccess = (res) => {
return res.idToken;
};
Expand All @@ -64,8 +59,13 @@ const getIdToken = async (account, instance) => {
return null;
};

// Failback to popup
return instance.acquireTokenPopup(req).then(onSuccess).catch(onError);
if (!(error instanceof InteractionRequiredAuthError)) {
return onError(error);
}

// Browsers are increasingly blocking third party cookies by default. Detect that option is combersome. Thus, we always use redirect instead of popup.
// See: https://github.com/AzureAD/microsoft-authentication-library-for-js/issues/3118#issuecomment-1655932572
return instance.acquireTokenRedirect(req).then(onSuccess).catch(onError);
});

return idToken;
Expand Down

0 comments on commit fcdb1f8

Please sign in to comment.