Hello,
I was looking at the documentation and it seems that there's no way to authenticate file uploads? For example, if a user logs into my app I want to upload their file to storage using their session so that no random people can upload files.
This also allows me to track who uploaded what file and who has access to it.
You can give bucket level permissions only allowing logged in users, or users with x label, or any number of items. You can also allow file level permissions giving only certain users access to a file.
Thank you! But how can this also be achieved in code? I'm very new to appwrite (but it's been AMAZING so far). I can't find it in the docs where to authenticate file uploads for apple
You set the permission in the console, in the bucket under settings. Then if you want file level permissions you can add them when creating the file.
https://appwrite.io/docs/references/cloud/client-web/storage#createFile
OOH so the 'permissions' field is what I set to tell the server "only this and that user can access this file"?
Yep
Thank you so much
You can use this set of docs for a bit more help on file/document permissions
https://appwrite.io/docs/advanced/platform/permissions#permission-types
Perfect. Thank you :))
[SOLVED] Authenticate File Uploads
Have a great rest of your day ๐
Sorry, just quickly. If I set the attached permissions for the bucket, will they still only be allowed to access their own files if I also set up file level security? Or do the bucket permissions override file level security entirely?
When file security is enabled, users will be able to access files for which they have been granted either File or Bucket permissions.
If file security is disabled, users can access files only if they have Bucket permissions. File permissions will be ignored..
Yes but does that mean if they have bucket permissions to read, it overwrites the file permission not to read?
Like if User A uploads a document and all users have bucket permission to read, would User B be able to read User As document which has file permissions enabled?
I believe File level supersedes bucket.
Perfect. Thank you so much once again!
thank you @darShan haha
And you Kenny
Recommended threads
- apple exchange code to token
hello guys, im new here ๐ I have created a project and enabled apple oauth, filled all data (client id, key id, p8 file itself etc). I generate oauth code form...
- Error: User (role: guests) missing scope...
I want to send a verification code to the user and the given phone number and check it and create a session right after the user entered the secret. For me that...
- Sign In With Apple OAuth Help
Hi All! I've got a flutter & appwrite app which Im trying to use sign in with apple for. I already have sign in with google working and the function is the sam...