Skip to content

Commit

Permalink
SCAL-225725 - Fixed failing /info for non-cookieless calls (#27)
Browse files Browse the repository at this point in the history
Co-authored-by: Aditya Mittal <[email protected]>
  • Loading branch information
jbhanu-thoughtspot and adityamittal3107 authored Sep 25, 2024
1 parent b5f28cc commit a115125
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 11 deletions.
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@thoughtspot/visual-embed-sdk",
"version": "1.32.7",
"version": "1.32.8",
"description": "ThoughtSpot Embed SDK",
"module": "lib/src/index.js",
"main": "dist/tsembed.js",
Expand Down Expand Up @@ -38,7 +38,7 @@
"size-limit": [
{
"path": "dist/tsembed.js",
"limit": "48 kB"
"limit": "49 kB"
}
],
"scripts": {
Expand Down Expand Up @@ -77,7 +77,7 @@
"gatsby-plugin-vercel": "^1.0.3",
"html-react-parser": "^1.4.12",
"lodash": "^4.17.21",
"mixpanel-browser": "^2.45.0",
"mixpanel-browser": "2.47.0",
"ts-deepmerge": "^6.0.2",
"tslib": "^2.5.3",
"use-deep-compare-effect": "^1.8.1"
Expand Down
6 changes: 5 additions & 1 deletion src/tokenizedFetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ import { AuthType } from './types';
export const tokenizedFetch: typeof fetch = async (input, init): Promise<Response> => {
const embedConfig = getEmbedConfig();
if (embedConfig.authType !== AuthType.TrustedAuthTokenCookieless) {
return fetch(input, init);
return fetch(input, {
// ensure cookies are included for the non cookie-less api calls.
credentials: 'include',
...init,
});
}

const req = new Request(input, init);
Expand Down
4 changes: 3 additions & 1 deletion src/utils/authService/authService.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ describe('Unit test for authService', () => {
const response = await fetchSessionInfoService(thoughtSpotHost);
expect(response.success).toBe(true);
expect(fetch).toHaveBeenCalledTimes(1);
expect(fetch).toBeCalledWith(`${thoughtSpotHost}${EndPoints.SESSION_INFO}`, {});
expect(fetch).toBeCalledWith(`${thoughtSpotHost}${EndPoints.SESSION_INFO}`, {
credentials: 'include',
});
});

test('fetchAuthTokenService', async () => {
Expand Down

0 comments on commit a115125

Please sign in to comment.