Hi, I'm trying to generate a url for an uploaded image in a bucket using file id.
Even though the user has an active session and read privilege to the image, I'm getting a 401 error saying user is not authorized.
As I understand this is due to credentials aren't being passed in the url and the resource in bucket dosent have read access to all.
Can I pass a JWT as a parameter to access the resource?
Is there any alternative approach I can access the image through a URL? I need to use it in CachedNetworkImage() Widget in flutter
When you authenticate a user you get a session object back. Save the session secret for that specific user and when the app user wants to access an image you can pass the secret in the headers.
"x-appwrite-session" : "<session.secret>"
Image.network() or CachedNetworkImage() dosent take headers for the request.
They do
You have to use the ImageProviders
Image(image: NetworkImage("<url>", headers: <headers>)),
Thank you. It worked
Recommended threads
- Functions not executing after usage rese...
Hi team, Last month my project hit 100% usage and functions stopped working (expected). Now the new month has started and usage has reset, requests are going ...
- Functions never end and always fail (sta...
Hi ! I'm using Appwrite Cloud Pro and function execution from appwrite website is KO. Deploying starter function template, execution is always Failed and the ...
- My function executions console if overwh...
It seems the requests are getting processed correctly but it is using a older version of the backend. And it seems the cron requests done an hour ago are shown ...