@alfabit/keycloak 0.0.14 → 0.0.16

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@alfabit/keycloak",
3
3
  "private": false,
4
- "version": "0.0.14",
4
+ "version": "0.0.16",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",
7
7
  "main": "src/index.ts",
@@ -290,26 +290,26 @@ export const isRtExp = () => {
290
290
  }
291
291
  };
292
292
 
293
- const isPopup = () => {
294
- console.log('run isPopup');
295
- // для авторизации в popup - это запускается в дочернем окне
296
- try {
297
- // Отправляем сообщение родителю
298
- if (window.opener) {
299
- console.log('window opener');
300
-
301
- window.opener.postMessage(
302
- {
303
- type: 'keycloak-auth-success',
304
- message: 'success',
305
- },
306
- '*'
307
- );
308
- }
309
- } catch (err) {
310
- console.warn('Error in login-popup-redirect.html:', err);
311
- }
312
- };
293
+ // const isPopup = () => {
294
+ // console.log('run isPopup');
295
+ // // для авторизации в popup - это запускается в дочернем окне
296
+ // try {
297
+ // // Отправляем сообщение родителю
298
+ // if (window.opener) {
299
+ // console.log('window opener');
300
+
301
+ // window.opener.postMessage(
302
+ // {
303
+ // type: 'keycloak-auth-success',
304
+ // message: 'success',
305
+ // },
306
+ // '*'
307
+ // );
308
+ // }
309
+ // } catch (err) {
310
+ // console.warn('Error in login-popup-redirect.html:', err);
311
+ // }
312
+ // };
313
313
 
314
314
  let isInitKeycloak = false;
315
315
 
@@ -353,7 +353,12 @@ export async function initKeycloak() {
353
353
  if (KEYCLOAK_LOGIN_REQUIRED || (window.opener && APP_NAME !== AppNameEnum.PASSPORT)) {
354
354
  initOptions.onLoad = 'login-required';
355
355
  } else if (isNeedAuth) {
356
- initOptions.onLoad = 'check-sso';
356
+ // initOptions.onLoad = 'check-sso';
357
+
358
+ clearTokens();
359
+ window.location.href = getUrl() as string;
360
+
361
+
357
362
  }
358
363
 
359
364
  if (!isNeedAuth) {
@@ -376,7 +381,7 @@ export async function initKeycloak() {
376
381
  if (res) {
377
382
  //await keycloak.value.updateToken(70);
378
383
  setTokens();
379
- isPopup();
384
+ // isPopup();
380
385
  keycloakUserData.value = keycloak.value?.tokenParsed ?? null;
381
386
  isAuth.value = true;
382
387
  try {