Thanks,
- I am logging in from frontend with admin role with roles system-full-access, rest-minimal and rest-file-management (UI & API) as suggested by you.
- First i logged in from my react frontend by getting the access token using method provided in jmix documentation using url https://xxx.xxxxxxx.xxx/oauth2/token providing it username, password, client id and client secret. I am getting the access_token successfuly.
- In next page, i am getting a list of entities, with one field as fileref, using rest query as given below using the same access token recd in step 1
“https://xxx.xxxxxxx.xxx/rest/queries/SiteDiaryEntry/siteDiaryEntryByProjectByDate?projectID=eb24099c-802f-89a3-2952-fa0551fa9ff6&lDate=2025-02-14”
I am getting the list of entities successfully. - Now, i am displaying these entities in cards in front end and showing the image file name in fileref in img tag in frontend providing src as url & token like this
<img key={index} src={https://xxx.xxxxxxx.xxx/rest/files?fileRef=${encodeURIComponent(entry.attachment)}&access_token=${location?.state?.data?.access_token}} alt=“SS”/>
All other data is properly displayed but the image download request is responded unauthorized.
I don’t exactly remember, in which version it was working as for last 3-4 months haven’t tested frontend. But it was always working.
For problem related to spaces in filename for files downloaded through restapi, i have also referred this forum discussion https://forum.jmix.io/t/file-downloading-via-rest-with-space-in-filename-wont-work/1655. Here also user is downloading file using access_token in url.
Please guide.
Regards