@mereb/web-runtime 0.0.1 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/providers/auth.js +0 -21
- package/package.json +1 -1
package/dist/providers/auth.js
CHANGED
|
@@ -95,21 +95,10 @@ function shouldRetryWithoutPkce(error) {
|
|
|
95
95
|
return false;
|
|
96
96
|
return message.includes('pkce') || message.includes('code_challenge');
|
|
97
97
|
}
|
|
98
|
-
function shouldDisableSilentSso(error) {
|
|
99
|
-
const message = extractErrorMessage(error).toLowerCase();
|
|
100
|
-
if (!message)
|
|
101
|
-
return false;
|
|
102
|
-
return message.includes('3rd party check iframe');
|
|
103
|
-
}
|
|
104
98
|
function resetPkceState(instance) {
|
|
105
99
|
;
|
|
106
100
|
instance.pkceMethod = undefined;
|
|
107
101
|
}
|
|
108
|
-
function disableSilentSso(instance) {
|
|
109
|
-
const mutableInstance = instance;
|
|
110
|
-
mutableInstance.silentCheckSsoRedirectUri = false;
|
|
111
|
-
mutableInstance.silentCheckSsoFallback = false;
|
|
112
|
-
}
|
|
113
102
|
async function attemptKeycloakInit(instance, options) {
|
|
114
103
|
try {
|
|
115
104
|
return await instance.init(options);
|
|
@@ -122,14 +111,6 @@ async function attemptKeycloakInit(instance, options) {
|
|
|
122
111
|
resetPkceState(instance);
|
|
123
112
|
return attemptKeycloakInit(instance, fallbackOptions);
|
|
124
113
|
}
|
|
125
|
-
if (options.silentCheckSsoRedirectUri && shouldDisableSilentSso(error)) {
|
|
126
|
-
console.warn('[auth] Silent SSO cookie probe failed (likely blocked /protocol/openid-connect/3p-cookies). Retrying without silent SSO so the shell can still load.', error);
|
|
127
|
-
const fallbackOptions = { ...options };
|
|
128
|
-
delete fallbackOptions.silentCheckSsoRedirectUri;
|
|
129
|
-
fallbackOptions.silentCheckSsoFallback = false;
|
|
130
|
-
disableSilentSso(instance);
|
|
131
|
-
return attemptKeycloakInit(instance, fallbackOptions);
|
|
132
|
-
}
|
|
133
114
|
throw error;
|
|
134
115
|
}
|
|
135
116
|
}
|
|
@@ -139,9 +120,7 @@ function initKeycloak() {
|
|
|
139
120
|
if (!keycloakInitPromise) {
|
|
140
121
|
const instance = getKeycloak();
|
|
141
122
|
const options = {
|
|
142
|
-
onLoad: 'check-sso',
|
|
143
123
|
pkceMethod: 'S256',
|
|
144
|
-
silentCheckSsoRedirectUri: `${globalThis.location.origin}/silent-check-sso.html`,
|
|
145
124
|
checkLoginIframe: false,
|
|
146
125
|
useNonce: false
|
|
147
126
|
};
|