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
- Project paused?
Hello, I have two Appwrite projects and I can not resume them for some reason. I'm using the free plan, and I saw in the pricing page that 2 free projects are a...
- Help
- Python TablesDB Rework
Hi, i starting to rework some older functions to TablesDB list_rows Method. I used list_documents with a resultset with worked fine. Now i tried to get all rows...