Skip to content

Commit af445ac

Browse files
committed
fix: pass idToken to data API fallback in fetchProjectActivationStatus
1 parent 1e7f0e7 commit af445ac

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

src/lib/api.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -544,18 +544,21 @@ query hasAnyDefaultEventTrackingSourceAndEvents($appId: ID!) {
544544
*
545545
* The query lives in Thunder (the main Amplitude app GraphQL server), served
546546
* at /graphql/org/:orgId. orgId is required to construct the endpoint URL.
547+
*
548+
* @param token - access_token used for the Thunder (Hydra-validated) path.
549+
* @param dataApiToken - raw id_token for the data API fallback when orgId is absent.
547550
*/
548551
export async function fetchProjectActivationStatus(
549552
token: string,
550553
zone: AmplitudeZone,
551554
appId: number | string,
552555
orgId?: string | null,
556+
dataApiToken?: string,
553557
): Promise<ProjectActivationStatus> {
554558
const { dataApiUrl } = AMPLITUDE_ZONE_SETTINGS[zone];
555559
// Use the Thunder org-scoped endpoint when orgId is available; fall back to
556560
// the data API (which may not expose this field for all users).
557-
// Thunder validates access_tokens via Hydra; data API accepts id_tokens.
558-
// Callers should pass the access_token — it works for both paths.
561+
// Thunder validates access_tokens via Hydra; data API accepts raw id_tokens.
559562
const isThunder = !!orgId;
560563
const url = isThunder ? thunderUrl(zone, orgId) : dataApiUrl;
561564
try {
@@ -564,7 +567,7 @@ export async function fetchProjectActivationStatus(
564567
{ query: ACTIVATION_STATUS_QUERY, variables: { appId: String(appId) } },
565568
{
566569
headers: {
567-
Authorization: isThunder ? `Bearer ${token}` : token,
570+
Authorization: isThunder ? `Bearer ${token}` : dataApiToken ?? token,
568571
'Content-Type': 'application/json',
569572
'User-Agent': WIZARD_USER_AGENT,
570573
},

src/ui/tui/screens/DataIngestionCheckScreen.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ export const DataIngestionCheckScreen = ({
7676
zone,
7777
appId,
7878
session.selectedOrgId,
79+
dataApiToken,
7980
);
8081
logToFile(
8182
`[DataIngestionCheck] poll result: hasAnyEvents=${status.hasAnyEvents} hasDetSource=${status.hasDetSource}`,

0 commit comments

Comments
 (0)