Skip to content

Fix 401 by using adminApi instead of raw axios#468

Merged
sahilds1 merged 1 commit intoCodeForPhilly:developfrom
amahuli03:467/unauthorized-pdf-upload
Feb 26, 2026
Merged

Fix 401 by using adminApi instead of raw axios#468
sahilds1 merged 1 commit intoCodeForPhilly:developfrom
amahuli03:467/unauthorized-pdf-upload

Conversation

@amahuli03
Copy link
Collaborator

Description

File uploads were resulting in 401 Unauthorized.

This was becauase UploadFile.tsx was using a raw axios.post() call instead of the adminApi client, so no JWT Authorization header was being sent with upload requests. uploadFile POST requests require authentication, so uploads were failing with 401.

@sahilds1 I tried your suggested fix and it worked. I was able to upload a file.

To reiterate the fix, I replaced axios.post() with adminApi.post(), which automatically attaches the JWT token via its request interceptor.
I also removed the explicit Content-Type: multipart/form-data header since Axios auto-sets it (with the required boundary parameter) when the body is a FormData.

Related Issue

Closes #467
Also may close #390, but I'm not sure

Manual Tests

I manually tested these changes by uploading a pdf and confirming successful upload with 201

Reviewers

@sahilds1 @taichan03

Notes

This might fix the 2nd error in issue #390, but would want to manually test with the original file to see if the error is still happening.

Copy link
Collaborator

@sahilds1 sahilds1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@sahilds1 sahilds1 merged commit 662f29d into CodeForPhilly:develop Feb 26, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

401 Unauthorized on PDF Upload BUG: File Upload Endpoint Error Analysis Report

2 participants