Skip to content

Commit 7c1b5c7

Browse files
committed
refactor(cloud-tests): update authentication method to use session cookie
1 parent 6d91987 commit 7c1b5c7

File tree

3 files changed

+6
-15
lines changed

3 files changed

+6
-15
lines changed

apps/app/src/app/(app)/[orgId]/cloud-tests/actions/run-platform-scan.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,10 @@ async function getAuthHeaders(organizationId: string): Promise<Record<string, st
1818
'X-Organization-Id': organizationId,
1919
};
2020

21-
// Get a JWT from Better Auth using the session cookie
22-
const tokenResponse = await auth.api.getToken({
23-
headers: reqHeaders,
24-
});
25-
26-
if (tokenResponse?.token) {
27-
authHeaders['Authorization'] = `Bearer ${tokenResponse.token}`;
21+
// Forward the session cookie for authentication
22+
const cookie = reqHeaders.get('cookie');
23+
if (cookie) {
24+
authHeaders['Cookie'] = cookie;
2825
}
2926

3027
return authHeaders;

apps/app/src/app/(app)/[orgId]/documents/components/CompanyFormPageClient.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ async function evidenceFormFetcher([endpoint, orgId]: readonly [
109109
string,
110110
string,
111111
]): Promise<EvidenceFormResponse> {
112-
const response = await api.get<EvidenceFormResponse>(endpoint, orgId);
112+
const response = await api.get<EvidenceFormResponse>(endpoint);
113113
if (response.error || !response.data) {
114114
throw new Error(response.error ?? 'Failed to load submissions');
115115
}
@@ -125,7 +125,7 @@ export function CompanyFormPageClient({
125125
}: {
126126
organizationId: string;
127127
formType: EvidenceFormType;
128-
isPlatformAdmin: boolean;
128+
isPlatformAdmin?: boolean;
129129
}) {
130130
const router = useRouter();
131131
const { mutate: globalMutate } = useSWRConfig();
@@ -289,7 +289,6 @@ export function CompanyFormPageClient({
289289
fileType: selectedFile.type || 'application/octet-stream',
290290
fileData,
291291
},
292-
organizationId,
293292
);
294293

295294
if (response.error) {
@@ -485,9 +484,6 @@ export function CompanyFormPageClient({
485484

486485
<DocumentFindingsSection
487486
formType={formType}
488-
isAuditor={isAuditor}
489-
isPlatformAdmin={isPlatformAdmin}
490-
isAdminOrOwner={isAdminOrOwner}
491487
/>
492488

493489
<Dialog

apps/app/src/app/(app)/[orgId]/documents/components/CompanySubmissionWizard.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,6 @@ export function CompanySubmissionWizard({
184184
fileType: file.type || 'application/octet-stream',
185185
fileData,
186186
},
187-
organizationId,
188187
);
189188

190189
if (response.error || !response.data) {
@@ -405,7 +404,6 @@ export function CompanySubmissionWizard({
405404
const response = await api.post(
406405
`/v1/evidence-forms/${submitFormType}/submissions`,
407406
payload,
408-
organizationId,
409407
);
410408

411409
if (response.error) {

0 commit comments

Comments
 (0)