Feature request: Custom image headers (AKA imageHeadersProvider
in Stream Chat Android SDK)
#2990
Labels
imageHeadersProvider
in Stream Chat Android SDK)
#2990
Summary:
This request is for a feature that already exists in Stream Chat Android SDK -
imageHeadersProvider
(more info on that: https://getstream.io/chat/docs/sdk/android/ui/general-customization/chatui/#adding-extra-headers-to-image-requests)Background:
We host user avatars on our own CDN that requires a valid
Authorization
header in order to serve images. Although the Android SDK provides the ability to add extra headers viaimageHeadersProvider
, the React Native SDK currently does not offer an equivalent feature. This forces us to override channel avatars, message avatars, group avatars, reply avatars and so on...Using
ImageComponent
prop on<Chat />
component does not help us because the image source is overriden by yourAvatar
,MessageAvatar
, ... (see more in the snippet below)Code snippet from Stream Chat
Avatar.tsx
:Proposed solution
Introduce an
imageHeadersProvider
(or similar mechanism) in the React Native SDK that mirrors the functionality available in the Android SDK. This feature should allow developers to supply a function or object that provides custom headers for every image request made by the SDK, ensuring that headers likeAuthorization
are consistently applied across all components. If the SDK supported animageHeadersProvider
, we could easily inject headers (e.g.,{ Authorization: 'Bearer <token>' }
) into every image request.Acceptance criteria
imageHeadersProvider
as a prop on theChat
component.imageHeadersProvider
are automatically applied to all image requests, including those in subcomponents such asMessageAvatar
,ChannelAvatar
, ... OR consider applying theimageHeadersProvider
only if the image source IS NOT a stream chat URL (I would like my JWT token to be sent only to my own servers).imageHeadersProvider
remain unaffected.The text was updated successfully, but these errors were encountered: