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

时间:2017-11-10 12:03:52

标签: getstream-io

我正在尝试使用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”字段(使用相同的标记)在多个时间轴中发布事件时出现以下错误:

卷曲-X POST -H “内容类型:应用/ JSON” -H “流-AUTH-类型:JWT” -H “授权:eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY3Rpb24iOiJ3cml0ZSIsImZlZWRfaWQiOiJ1c2VyMSIsInJlc291cmNlIjoiZmVlZCJ9.r0zd_F0ujWKnNMCLiKVeZbfruy6 -...” -d “{\” actor \“:\”user:1 \“,\”verb \“:\”status \“,\”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,\“course_name \”:\“Admiral Baker,North \”,\“city \”:\“San Diego \”,\“state_name \”:\“California \”,\“banner_image_url \“:\”/ ui / images / courses / golfcourse_detail.jpg \“},\”status \“:\”示例字符串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}

1 个答案:

答案 0 :(得分:0)

您使用的是哪种语言?根据语言的不同,将提供API客户端。您可以在"到"中获取相应Feed的令牌/签名。数组并添加如下:

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客户端都有类似的方法)