@alfabit/keycloak 0.0.34 → 0.0.35

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.34",
4
+ "version": "0.0.35",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",
7
7
  "main": "src/index.ts",
@@ -1,7 +1,7 @@
1
1
  import Keycloak, { type KeycloakInitOptions } from 'keycloak-js';
2
2
  import { inject, reactive, readonly, type Ref, ref } from 'vue';
3
3
  import { postWebLogin } from '../api/wallet/endpoints';
4
- import { AppNameEnum, APP_NAME, IS_TELEGRAM_MINI_APP, KEYCLOAK_LOGIN_REQUIRED, OPENID_CLIENT_ID, OPENID_REALM, OPENID_URL, LocationEnum } from '@alfabit/constants';
4
+ import { AppNameEnum, APP_NAME, IS_TELEGRAM_MINI_APP, KEYCLOAK_LOGIN_REQUIRED, OPENID_CLIENT_ID, OPENID_REALM, OPENID_URL, LocationEnum, IS_LOCALHOST } from '@alfabit/constants';
5
5
 
6
6
  export type TIdpHint = 'email' | 'google' | 'apple';
7
7
 
@@ -270,7 +270,7 @@ function clearTokens() {
270
270
  sessionStorage.removeItem(ID_TOKEN_NAME);
271
271
  }
272
272
 
273
- export const getToken = () => (IS_TELEGRAM_MINI_APP ? sessionStorage.getItem(TOKEN_NAME) : localStorage.getItem(TOKEN_NAME)) ?? undefined;
273
+ export const getToken = () => (IS_TELEGRAM_MINI_APP && !IS_LOCALHOST ? sessionStorage.getItem(TOKEN_NAME) : localStorage.getItem(TOKEN_NAME)) ?? undefined;
274
274
 
275
275
  const parseJwt = (token: unknown) => {
276
276
  if (typeof token !== 'string') throw new Error('Invalid JWT format: #1');