Back

Fetching a storage document that have permissions restrictions

  • 0
  • Web
  • Storage
  • Cloud
mirsella
3 May, 2024, 13:01

hello !

i'm trying to play a video stored on a storage bucket, where the bucket has the read permissions only for user with the premium label. I'm authenticated everything is working, i see the labels using account.get().

const url = storage.getFileView("videos", file_id); this call is working, i can get the url with url.href but when fetching it i get a 401 unauthorized. Looking at the request (see attachment), no cookies or header to authenticate are sent, so it's normal that i get a 401.

everything was working before the cloud upgrade to v1.15, and i'm using createemailpasswordsession to auth.

how can i fetch the video file ?

thanks !

TL;DR
Developers are having trouble fetching a video stored on a storage bucket with permissions restrictions. After a cloud upgrade, they are getting a 401 unauthorized error indicating missing authentication headers in the request. Solution: Manually add the necessary authentication headers or cookies when fetching the video file.
Binyamin
3 May, 2024, 13:12

How do you fetch it? manually?

Binyamin
3 May, 2024, 13:13

If so, because you're on localhost you won't get the cookies

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more