Skip to content

Commit 9b3c65f

Browse files
committed
fix: fix the missing token
1 parent 00c9a47 commit 9b3c65f

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

src/javascript/_common/auth.js

+14-5
Original file line numberDiff line numberDiff line change
@@ -144,12 +144,21 @@ export const requestSingleSignOn = async () => {
144144
// and if feature flag for OIDC Phase 2 is enabled - isAuthEnabled
145145
// Check if any account or its linked account is missing a token
146146

147+
const hasMissingToken = Object.values(clientAccounts).some((account) => {
148+
// Check if current account is missing token
149+
if (!account?.token) {
150+
return true; // No linked accounts and no token
151+
}
152+
return false;
153+
});
154+
147155
const shouldRequestSignOn =
148-
isLoggedInCookie &&
149-
!isCallbackPage &&
150-
!isEndpointPage &&
151-
(!isClientAccountsPopulated) &&
152-
isAuthEnabled;
156+
isLoggedInCookie &&
157+
!isCallbackPage &&
158+
!isEndpointPage &&
159+
(!isClientAccountsPopulated ||
160+
(isClientAccountsPopulated && hasMissingToken)) &&
161+
isAuthEnabled;
153162

154163
if (shouldRequestSignOn) {
155164
const currentLanguage = Language.get();

0 commit comments

Comments
 (0)