Not authorized File Message

Hi @Tyler
hope you are doing good
I’ve a problem access the uploaded image from sendbird
my image is shown on sendbird dashboard, but not fetching that image
I’m new in sendbrid
could you help me please

Hi @Daud,

Welcome to the Sendbird community. Can you expand on what specifically you mean? Are you unable to view the image when fetching it via the SDK?

Hi @Tyler How are you
I uploaded a video to send bird …but in response url I didn’t get the auth token with url
could you help me


This is the response what I get
when I uploaded Image its work perfectly, but Video is uploaded when is logout and then login video is not showing

Hi @Daud,

How did you upload this file? The file doesn’t have an auth key because the file path is a local file path and not an actual web URL.

Hey
thanks for replying…Simply uploaded using react-native-image-picker library
then i directly upload to sendbird… same as I uploaded image to sendbird and its working fine

I just passed the file uri to params.fileUrl

Now I uploaded a “http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerJoyrides.mp4” url but it does show me any auth in their response

Hi @Daud,

The issue may be that you’re using fileUrl, which assumes you’re hosting the image else where. When using fileUrl, the image doesn’t get uploaded to Sendbird, and as a result doesn’t require an authKey. If the file is not uploaded to Sendbird, it’s not encrypted by us.

Hey @Tyler, the response you provided above was really helpful:

In the SDK, the response you get contains a url key on the message object. This url contains the authenticated URL that you need to view the encrypted file.

Could you sway someone to add such information to your Javascript SDK API docs? The FileMessage documentation does not even mention the url property, nor does it mention any auth considerations around the plainUrl property. This can lead users to think that FileMessage#plainUrl is enough for file message access to just work. Mentioning the url property and perhaps the purpose of plainUrl vs. url in the SDK API docs might help others avoid this confusion in the future.

The error message I received when using plainUrl was about domain authorization which was a red herring. It was only when I stumbled on your response above that I managed to find the 1 relevant line in the Share an encrypted file with other participants docs:

This can be easily done by retrieving the fileMessage.url property, which returns the unique file URL containing the parameter auth with an encryption key of the current user.

Using the FileMessage#url property solved the issue for me. I would not have guessed searching for a url property were it not for this post though since the SDK API docs don’t mention one. :man_shrugging:

Hi @Nicholas_Gelinas,

This is great feedback that I’ll bring to our documentation team for review.

Thanks,
Tyler

I’m getting the same issue. Unable to access file message.

Hey @Tyler

I ran into the same issue with webhooks. So when I receive a group_channel:message_send, the file URL is not signed. Is there any way to sign it myself using an API token?

The request payload I got:

{
  app_id: FILTERED,
  category: group_channel:message_send,
  channel: {
      channel_url: sendbird_group_channel_filtered,
      custom_type: "",
      data: "",
      is_discoverable: False,
      is_distinct: False,
      is_ephemeral: False,
      is_public: False,
      is_super: False,
      name: Group Channel,
      type: group
  },
  custom_type: "",
  format: json,
  members: [FILTERED],
  mention_type: users,
  mentioned_users: [],
  message_events: {
    send_push_notification: receivers,
    update_last_message: True,
    update_mention_count: True,
    update_unread_count: True
  },
  payload: {
    content_size: 22595,
    content_type: image/png,
    created_at: 1687430679603,
    custom_type: "",
    data: ,
    filename: filename.png,
    message_id: 2847844277,
    url: https://file-us-1.sendbird.com/2fcc238dfe284a8f9236ea91c5ea42bf.png
  },
  sdk: JavaScript,
}

Hi @Slava_Alexeev,

You would not get a signed URL in a webhook. You would need to authenticate the URL by fetching it the same way you’d get something from the Platform API, with the Api-Token which would then redirect you to a temporarily signed URL.

Signing ONLY occurs natively in the SDK because the SDK generates the signed URL locally.