Back

How to allow authenticated user to show image without passing JWT [Flutter]

  • 0
  • Flutter
  • Storage
Monzim
8 Apr, 2023, 18:16

I want to load image in markdown file. But the problem the image file bucket permission is set to Role.users() Is there any way to allow access only the authenticated user to show the image without passing JWT?

TL;DR
User wants to know how to allow an authenticated user to show an image without passing a JWT in Flutter. One suggestion is to use the `Image.network` method with a header param containing the JWT. The user can also implement a custom image builder using the Flutter Markdown library. The image file bucket permission is currently set to Role.users(), and the user asks if there is a way to allow access only to authenticated users without passing a JWT.
Drake
8 Apr, 2023, 18:18

What library are you using for markdown

Monzim
8 Apr, 2023, 18:19
TypeScript
flutter_markdown:
Monzim
8 Apr, 2023, 18:47

Yes there I can use the imageBuilder and pass the JWT with the Image.network header. Can you share a example of using appwrite JWT with Flutter Image.network

safwan
8 Apr, 2023, 18:48

Image.network has a header param.

TypeScript
Image.network(
  '[your-image-source-url]',
  headers: {
    'X-Appwrite-JWT': '[your-jwt-here]'
  },
);
safwan
8 Apr, 2023, 18:48

Will this not work?

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more