无法通过流源上传图像

问题描述 投票:0回答:1

我正在使用 GetStream Feeds 和 stream_feed_flutter_core 来构建类似 Instagram 的应用程序。我可以向提要添加活动,甚至可以上传文件,但无法上传图像。

我遵循的设置客户端和用户的步骤:

  1. final client = StreamFeedClient("apiKey", logLevel: Level.INFO);
  2. 最终 currentUser = 等待 client.setUser( 用户( id: user2Id, 数据: {"name": user1Name, "profile_image": user2Image}), 代币(token_2));

上传图片步骤:

  1. 从图库中选择图像作为 XFile PickFile
  2. 上传图片()异步{ var imageUrl =等待context.feedClient.images.upload(AttachmentFile(路径:pickFile.path)); }

流API响应:

{
  "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"
}
flutter dart feed getstream-io getstream-chat
1个回答
0
投票

你能

setUser
吗? 你得到了什么
context.feedClient

就我而言,它工作正常

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)
    }
最新问题
© www.soinside.com 2019 - 2024. All rights reserved.