How to modify the fetch function for client uploads so I can include credentials
Hi folks, I am new to UploadThing and got file uploads working with my React client and Fastify API.
One issue I am having is that I had to get rid of
http-only
cookie based auth for my JWT storage and had to fallback to local storage just so I could send my token over the wire from the file upload dropzone in the react code to my Fastify app. I use the token to validate that the user is authenticated and then upload the url to my db.
Obviously storing the token in local-storage is less secure than an http-only cookie, but I cannot seem to include credentials in the uploadthing component.
Does anyone know how I can send cookies (or if that's even supported in UploadThing) ?1 Reply
same issue. Following this thread
update, issue is not the same. i am getting cookies on my backend all good:
Im just looking for a way to send custom authorization headers along with the upload reqs
@Tanner Barcelos heyo, just worked through this on my end. may not be what you need but i thought id send here.
this worked for me:
I realize you were worried more about http only cookies but yea IDK 😄 maybe this helps maybe na