# Supply authenticated Images as custom Avatar URL to updateCurrentUser()

**URL:** <https://forum.social.plus/t/supply-authenticated-images-as-custom-avatar-url-to-updatecurrentuser/730>\
**Category:** Web\
**Created:** [May 10, 2023, 10:01am UTC](https://forum.social.plus/t/supply-authenticated-images-as-custom-avatar-url-to-updatecurrentuser/730 "2023-05-10T10:01:57Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![webo](https://avatars.discourse-cdn.com/v4/letter/w/90ced4/32.png) [@webo](https://forum.social.plus/u/webo)\
**Post date:** [May 10, 2023, 10:01am UTC](https://forum.social.plus/t/supply-authenticated-images-as-custom-avatar-url-to-updatecurrentuser/730/1 "2023-05-10T10:01:57Z")

</div>

My images sit behind a protected API route/url (i.e requires secret Basic Authentication credentials). Is there any way to supply “Authorization” headers to the avatarCustomUrl field such that the Authenticated images are fetched properly.

Or maybe I could fetch my protected image separately with necessary credentials and then supply the Image blob to the Amity Client ?

Is there any way to achieve this ?

---

<div class="post-metadata">

**Author:** ![SocialPlus\_Support](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.social.plus/socialplus_support/32/798_2.png) [@SocialPlus\_Support](https://forum.social.plus/u/SocialPlus_Support)\
**Post date:** [May 11, 2023, 8:19am UTC](https://forum.social.plus/t/supply-authenticated-images-as-custom-avatar-url-to-updatecurrentuser/730/2 "2023-05-11T08:19:41Z")

</div>

@webo May we please confirm your platform & version? Thank you

---

<div class="post-metadata">

**Author:** ![webo](https://avatars.discourse-cdn.com/v4/letter/w/90ced4/32.png) [@webo](https://forum.social.plus/u/webo)\
**Post date:** [May 11, 2023, 8:33am UTC](https://forum.social.plus/t/supply-authenticated-images-as-custom-avatar-url-to-updatecurrentuser/730/3 "2023-05-11T08:33:39Z")

</div>

Our UI Kit is for the Web Open Source, found here [GitHub - AmityCo/Amity-Social-Cloud-UIKit-Web-OpenSource](https://github.com/AmityCo/Amity-Social-Cloud-UIKit-Web-OpenSource)

Our Amity JS SDK is “@amityco/js-sdk”: “^5.32.0”,

Our Application is a plain Create React App template based on React 17.

---

<div class="post-metadata">

**Author:** ![cijin](https://avatars.discourse-cdn.com/v4/letter/c/49beb7/32.png) [@cijin](https://forum.social.plus/u/cijin)\
**Post date:** [May 12, 2023, 4:04am UTC](https://forum.social.plus/t/supply-authenticated-images-as-custom-avatar-url-to-updatecurrentuser/730/4 "2023-05-12T04:04:48Z")

</div>

Hey @webo,

You could possibly do something like this. Fetch the authenticated image separately, get a fileId for the image (by using the sdk method). Use this fileId to update the avatar of the user.

Is this a viable option?

The SDK uses the authorization header currently, so this might not be a viable option.

---

<div class="post-metadata">

**Author:** ![webo](https://avatars.discourse-cdn.com/v4/letter/w/90ced4/32.png) [@webo](https://forum.social.plus/u/webo)\
**Post date:** [May 12, 2023, 5:10am UTC](https://forum.social.plus/t/supply-authenticated-images-as-custom-avatar-url-to-updatecurrentuser/730/5 "2023-05-12T05:10:08Z")

</div>

> [@cijin](#):
>
> get a fileId for the image (by using the sdk method). Use this fileId to update the avatar of the user.

How do I generate a fieldId for my protected images ? I [found this](https://docs.amity.co/core-concepts/files-images-and-videos/image-handling#upload-images), but there aren’t any examples for Javascript. Could you please maybe provide me a working Web Javascript SDK example to upload image ?

---

<div class="post-metadata">

**Author:** ![cijin](https://avatars.discourse-cdn.com/v4/letter/c/49beb7/32.png) [@cijin](https://forum.social.plus/u/cijin)\
**Post date:** [May 12, 2023, 6:16am UTC](https://forum.social.plus/t/supply-authenticated-images-as-custom-avatar-url-to-updatecurrentuser/730/6 "2023-05-12T06:16:25Z")

</div>

I think protected images will need to be fetched prior to uploading and generating a fileId.

You could try [this api](https://docs.amity.co/core-concepts/files-images-and-videos/file)
