0

I'm using GetStream Feeds and stream_feed_flutter_core for building a instagram like app. I'm able to add activity to the feeds and even able to upload files but not able to upload images.

Steps I'm following for setting up the client and user:

  1. final client = StreamFeedClient("apiKey", logLevel: Level.INFO);
  2. final currentUser = await client.setUser( User( id: user2Id, data: {"name": user1Name, "profile_image": user2Image}), Token(token_2));

Steps for uploading the images:

  1. Pick an image from gallery as XFile pickedFile
  2. uploadImage() async{ var imageUrl = await context.feedClient.images.upload(AttachmentFile(path: pickedFile.path)); }

Stream API response:

{
  "detail":"token contains an invalid number of segments",
  "status_code":403,
  "code":17,
  "exception":"NotAllowedException",
  "duration":"0.00ms",
  "more_info":"https://getstream.io/docs/api_error_responses"
}
Anand
  • 4,355
  • 2
  • 35
  • 45
Anupriya
  • 5
  • 2
  • Hi, looks like the JWT token has the wrong signature, how do you generate the token? – Sacha Arbonel Jun 20 '23 at 21:04
  • Initially I was using the User JWT Generator [link](https://getstream.io/chat/docs/react/token_generator/) to generate the token which was doing the job, the client and user were getting connected, I was able to add activities to the feed, add reactions to the activities and everything except for uploading the images, then I used this stream_feed_cli tutorial [link]https://github.com/HayesGordon/stream-feed-cli to generate tokens but the issue still persists. – Anupriya Jun 21 '23 at 03:56

1 Answers1

0

are you able to setUser? what do you get the context.feedClient

In my case it is working fine

this.client = connect(API_KEY, this.userToken, APP_ID)

  async uploadImage (file) {
    return new Promise((resolve, reject) =>
      (async () => {
        try {
          const imgSrc = await this.client.images.upload(file)
          resolve(imgSrc)
        } catch (err) {
          reject(err)
        }
      })()
    )
  }

const uploadImageSrc = async e => {
    const image = e.target.files[0]
    uploadImage(image)
    }

If this is helpful, please upvote and like, thanks.