Skip to content

SCAL-339768 Reuse token between REST API SDK & Visual Embed SDK - #71

Merged
ts-nk-github-cplot merged 6 commits into
mainfrom
SCAL-339768
Sep 29, 2026
Merged

ts-nk-github-cplot merged 6 commits into
mainfrom
SCAL-339768

Conversation

@ts-nk-github-cplot

@ts-nk-github-cplot ts-nk-github-cplot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Create an application using REST API SDK - Typescript & Liveboard Embed and let them share the same token for cookieless and manage it.

Application should have Liveboard list pages which uses REST API SDK and clicking on the item open the liveboard embed for that liveboard

Approach

getCachedAuthToken function is shared as the token source for both the REST API SDK's bearer auth config and the Embed SDK's cookieless getAuthToken. It caches the resolved token in memory and reuses it while it has more than 30s left before expiry, refetching from /api/thoughtspot-token otherwise. Concurrent callers during a refetch (e.g. the initial liveboard list fetch and the embed's auth init firing near-simultaneously) share the same in-flight request instead of each triggering a separate token fetch.

Comment thread solutions/reuse-token-rest-api-and-embed-sdk/vanilla/src/thoughtspot-client.ts Outdated
Comment thread solutions/reuse-token-rest-api-and-embed-sdk/vanilla/src/main.ts Outdated
@ts-nk-github-cplot
ts-nk-github-cplot merged commit c042870 into main Sep 29, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants