Skip to content

Commit e606cb6

Browse files
authored
Ci/XSRF token being retrieved without the API key makes it invalid for subsequent calls (#128)
* fix: xsrf token must be retrieved with the API key because of claims-user association. * chore: add exception for typescript-eslint/naming-convention * chore: make exception for single lines
1 parent 8acc4b3 commit e606cb6

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

packages/runtime/test/lib/AdminApiClient.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,12 @@ export async function getBackboneAdminApiClient(): Promise<Axios> {
1010

1111
const adminAPIBaseUrl = process.env.NMSHD_TEST_BASEURL_ADMIN_API!;
1212
if (!adminAPIBaseUrl) throw new Error("Missing environment variable NMSHD_TEST_BASEURL_ADMIN_API");
13-
const csrf = await axios.get(`${adminAPIBaseUrl}/api/v1/xsrf`);
13+
const csrf = await axios.get(`${adminAPIBaseUrl}/api/v1/xsrf`, {
14+
headers: {
15+
/* eslint-disable-next-line @typescript-eslint/naming-convention */
16+
"x-api-key": process.env.NMSHD_TEST_ADMIN_API_KEY!
17+
}
18+
});
1419
adminClient = axios.create({
1520
baseURL: adminAPIBaseUrl,
1621
headers: {

packages/transport/test/testHelpers/AdminApiClient.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,13 @@ export class AdminApiClient {
1111
}
1212
const adminAPIBaseUrl = process.env.NMSHD_TEST_BASEURL_ADMIN_API;
1313
if (!adminAPIBaseUrl) throw new Error("Missing environment variable NMSHD_TEST_BASEURL_ADMIN_API");
14-
const csrf = await axios.get(`${adminAPIBaseUrl}/api/v1/xsrf`);
14+
const csrf = await axios.get(`${adminAPIBaseUrl}/api/v1/xsrf`, {
15+
headers: {
16+
/* eslint-disable-next-line @typescript-eslint/naming-convention */
17+
"x-api-key": process.env.NMSHD_TEST_ADMIN_API_KEY!
18+
}
19+
});
20+
1521
AdminApiClient.adminClient = axios.create({
1622
baseURL: adminAPIBaseUrl,
1723
headers: {

0 commit comments

Comments
 (0)