Skip to content

Commit

Permalink
Ci/XSRF token being retrieved without the API key makes it invalid fo…
Browse files Browse the repository at this point in the history
…r 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
  • Loading branch information
Dannyps authored May 13, 2024
1 parent 8acc4b3 commit e606cb6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
7 changes: 6 additions & 1 deletion packages/runtime/test/lib/AdminApiClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ export async function getBackboneAdminApiClient(): Promise<Axios> {

const adminAPIBaseUrl = process.env.NMSHD_TEST_BASEURL_ADMIN_API!;
if (!adminAPIBaseUrl) throw new Error("Missing environment variable NMSHD_TEST_BASEURL_ADMIN_API");
const csrf = await axios.get(`${adminAPIBaseUrl}/api/v1/xsrf`);
const csrf = await axios.get(`${adminAPIBaseUrl}/api/v1/xsrf`, {
headers: {
/* eslint-disable-next-line @typescript-eslint/naming-convention */
"x-api-key": process.env.NMSHD_TEST_ADMIN_API_KEY!
}
});
adminClient = axios.create({
baseURL: adminAPIBaseUrl,
headers: {
Expand Down
8 changes: 7 additions & 1 deletion packages/transport/test/testHelpers/AdminApiClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,13 @@ export class AdminApiClient {
}
const adminAPIBaseUrl = process.env.NMSHD_TEST_BASEURL_ADMIN_API;
if (!adminAPIBaseUrl) throw new Error("Missing environment variable NMSHD_TEST_BASEURL_ADMIN_API");
const csrf = await axios.get(`${adminAPIBaseUrl}/api/v1/xsrf`);
const csrf = await axios.get(`${adminAPIBaseUrl}/api/v1/xsrf`, {
headers: {
/* eslint-disable-next-line @typescript-eslint/naming-convention */
"x-api-key": process.env.NMSHD_TEST_ADMIN_API_KEY!
}
});

AdminApiClient.adminClient = axios.create({
baseURL: adminAPIBaseUrl,
headers: {
Expand Down

0 comments on commit e606cb6

Please sign in to comment.