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
- Updating GitHub App access throws error
Steps to reproduce - 1. Have some private repos allowed on the install access 2. New Site/Func > Connect GitHub > see the side card saying `Missing a repo` > cl...
- Bug report: Race condition in Flutter SD...
Hi team, I've found an intermittent bug in the Flutter SDK (v20.3.0) when using `createOAuth2Session` on Android. **Symptoms** After `createOAuth2Session` re...
- New Build not visible on Domain
I pushed some new code to my Appwrite Site and the build succeeded and is shown as active. Yet, I can only see the new version of the site on Appwrite's provide...