in packages/azure-kusto-ingest/src/resourceManager.ts [224:242]
async getAuthorizationContextFromService() {
const retry = new ExponentialRetry(ATTEMPT_COUNT, this.baseSleepTimeSecs, this.baseJitterSecs);
while (retry.shouldTry()) {
try {
const response = await this.kustoClient.execute("NetDefaultDB", ".get kusto identity token");
const next = response.primaryResults[0].rows().next();
if (next.done) {
throw new Error("Failed to get authorization context - got empty results");
}
return next.value.toJSON<{ AuthorizationContext: string }>().AuthorizationContext;
} catch (error: unknown) {
if (!(error instanceof KustoDataErrors.ThrottlingError)) {
throw error;
}
await retry.backoff();
}
}
throw new Error(`Failed to get identity token from server - the request was throttled ${ATTEMPT_COUNT} times.`);
}