GetStream API错误:目标负载不完整(缺少签名)



我正在尝试使用GetStream API在时间线中发布活动。

如果我在一个时间线上发布,效果会很好。例如:

curl -X POST -H "Content-Type: application/json" -H "Stream-Auth-Type: jwt" -H "Authorization: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY3Rpb24iOiJ3cml0ZSIsImZlZWRfaWQiOiJ1c2VyMSIsInJlc291cmNlIjoiZmVlZCJ9.r0zd_F0ujWKnNMCLiKVeZbfruy6-..." -d "{"actor": "user:1","verb": "status","object": "1","user": {"display_name": "Administrator","first_name": "golflink1","last_name": "Administrator","gender": "Female","profile_pic_thumb_url": ""},"course": {"course_id": 879,"course_name": "Admiral Baker, North","city": "San Diego","state_name": "California","banner_image_url": "/ui/images/courses/golfcourse_detail.jpg"},"status": "sample string 1"}" https://api.stream-io-api.com/api/v1.0/feed/user/1/?api_key=...

但当我试图使用"to">字段(使用相同的令牌)在多个时间线中发布事件时,我会出现以下错误:

curl-X POST-H"内容类型:application/json"-H"流身份验证类型:jwt"-H \"object":\"1\">,\"to":[\"timeline:global\",\"course:879\","city:US_CA_San_Diego\"],"user\":{\"display_name":\"Administrator\",\"first_name":"golflink1\","last_name\":"Administrator","gender":"Female","profile_pic_thumb_url":"\"},"course\"::"course_id":879,"couse_name":"Admiral Baker,North","city":"San Diego","state_name"::\"California",\"banner_image_url\":\"/ui/images/courses/golfcourse_detail.jpg"},\"status":\"sample string 1\"}"https://api.stream-io-api.com/api/v1.0/feed/user/1/?api_key=...

响应错误:

{"code": 4, "detail": "To target payload is incomplete (missing signature)", "duration": "14ms", "exception": "InputException", "status_code": 400}

您使用的是什么语言?根据语言的不同,将提供一个API客户端。您可以在"to"数组中获得相应提要的令牌/签名,并按如下方式添加:

feed = client.feed(slug, id);
// instead of the feed id, give the feed id and the token an a sub-array
to = [
[feed.id, feed.token],
];
// or concatenate the id and the token with a space:
to = [
feed.id + ' ' + feed.token
];

(伪代码,但所有API客户端都有类似的方法)

最新更新