#Access forbidden while trying to download file

21 messages · Page 1 of 1 (latest)

candid forum
#

Hi so im trying to download a file from my server and it constantly returns access forbidden, ive tried changing permission role public to be able to read directus_files
ive also tried to pass static access tokens from admin user in parameters. I'm really stuck on this can anyone help please?

charred canopy
#

permission denied probably means the file you're trying to access doesnt exist (if you've checked the access token). How exactly are you trying to download this file? does it work when doing it from the app?

candid forum
#

im just trying to download it via link

#

i need that to work because i know i cant add attachment to an email

charred canopy
#

What link exactly are you using? and does it work when downloading from the app? as that should be the same link

charred canopy
#

ah there you go, http://0.0.0.0 is not a valid IP try http://localhost or http://127.0.0.1 instead

#

altough you should be getting a 404 on the 0.0.0.0 request not forbidden

#

presuming you manually replaced the domain for some reason before, then its probably the uuid thats invalid (there's no - dashes in there)

candid forum
#

yeah its all the same response, still access forbidden

#

i didnt change the domain, the only place where dash sign is its in access token of admin user

charred canopy
charred canopy
#

try downloading it in the app and compare the 2 urls 😉

charred canopy
#

should be something like e4f4-077f-6d1f-715a-0778-6ff7-692a-8d1d

candid forum
#

yeah thats what ive been thinking the access token within the app download is way different but i dont seem to be able to get it

charred canopy
#

the access token in the app is a temporary one so that will differ yeah

candid forum
#

now it seems to work, can i get the file uuid via ItemsService?

#

or is there a different way to get it ?

charred canopy
#

Many ways to get it depending on in what context you're working as they are the IDs of the files collection