Stream Feed Image url

103 Views Asked by At

The Stream feeds documents state that after uploading an image:

The returned URL is served via CDN and can be requested by anyone. In order to avoid resource enumeration attacks, a unique signature is added. Manipulating the returned URL will likely result in HTTP errors. Every time that you retrieve the activity/reaction where the file/image was uploaded, the URL will be refreshed.

If I was creating/updating a user and I store the url in the data object associated in with the user as a key/value of

{image: 'userprofileimage.com'}

when I retrieve the user will the image url be refreshed or will it expire after 14 days?

I tried adding the image and it uploads but am unsure when the url will expire.

1

There are 1 best solutions below

0
Aditya Agarwal On

You only need the URL without the query params to store it in your user object, like this.

usr, err:=client.Users().Add(ctx, stream.User{
    ID:   userID,
    Data: map[string]any{
        "image":"https://oregon.stream-io-cdn.com/<app_id>/attachments/<image>.jpeg",
    },
}, false)

When you fetch the user object at a later time, GetStream will automatically provide a new URL with a different signature and key-pair-id each time.