Skip to content

Commit

Permalink
Fix createchrome for keycloak
Browse files Browse the repository at this point in the history
  • Loading branch information
aneelac22 committed Aug 23, 2023
1 parent aafb4b5 commit 39271b5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/chrome/create-chrome.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
toggleFeedbackModal,
toggleGlobalFilter,
} from '../redux/actions';
import { ITLess, getEnv, getEnvDetails, isBeta, isProd, updateDocumentTitle } from '../utils/common';
import { ITLess, ITLessCognito, getEnv, getEnvDetails, isBeta, isProd, updateDocumentTitle } from '../utils/common';
import { createSupportCase } from '../utils/createCase';
import debugFunctions from '../utils/debugFunctions';
import { flatTags } from '../components/GlobalFilter/globalFilterApi';
Expand Down Expand Up @@ -99,10 +99,11 @@ export const createChromeContext = ({
};

const isITLessEnv = ITLess();
const isITLessCognito = ITLessCognito();

const api: ChromeAPI = {
...actions,
auth: isITLessEnv ? createCognitoAuthObject(store) : createAuthObject(libJwt, getUser, store, modulesConfig),
auth: isITLessCognito ? createCognitoAuthObject(store) : createAuthObject(libJwt, getUser, store, modulesConfig),
initialized: true,
isProd,
forceDemo: () => Cookies.set('cs_demo', 'true'),
Expand All @@ -113,7 +114,7 @@ export const createChromeContext = ({
getEnvironmentDetails: () => getEnvDetails(),
createCase: (fields?: any) => getUser().then((user) => createSupportCase(user!.identity, libJwt, fields)),
getUserPermissions: async (app = '', bypassCache?: boolean) => {
if (isITLessEnv) {
if (isITLessCognito) {
const cogToken = await getTokenWithAuthorizationCode();
return fetchPermissions(cogToken || '', app, bypassCache);
} else {
Expand Down

0 comments on commit 39271b5

Please sign in to comment.