Hello, This is my utility function for obtaining the users' avatar url.
Is this a safe approach to the problem? I am also unsure about ending the url with &mode=admin. The issue is, without &mode=admin, it doesn't load the avatars.
export const getAvatarUrl = (avatarId) => {
if (!avatarId) return null;
const url = `${import.meta.env.VITE_ENDPOINT}/storage/buckets/${import.meta.env.VITE_AVATAR_BUCKET}/files/${avatarId}/view?project=${import.meta.env.VITE_PROJECT}&mode=admin`;
return url;
};
Safe Approach to Bucket
mode admin only works for your console session, it will not work for other people. if you want to share this image with others you need to either allowing from your bucket or file permissions depending on which security model you're using
Recommended threads
- Locked out of account
Hey guys, I have a paid account and have been locked out. Apologies for using this method, but I'm getting no response via the contact us page. I had a old do...
- Transaction Error
AppwriteException: Transaction with the requested ID could not be found. at Generator.next (<anonymous>) { code: 404, type: 'transaction_not_found', r...
- Can not get the logged in user data in N...
I'm trying to get the user data after i log in with otp but it get this error : AppwriteException: User (role: guests) missing scopes (["account"]) at Gen...