响应详细错误:2,errMsg:post方法api主体检查失败!声网 REST API

问题描述 投票:0回答:3
const Authorization = `Basic ${Buffer.from(`${config.CUSTOMERID}:${config.CUSTOMER_SECRET}`).toString("base64")}`;
const acquire = await axios.post(`https://api.agora.io/v1/apps/${config.agoraAppId}/cloud_recording/acquire`,{
                          cname: groupId,
                          uid: userId,
                          clientRequest: {
                          },
                        },
                        { headers: { Authorization } }
                      );

使用axios从nodejs代码调用agora直播云录音时得到以下响应。

{
 code: 2,
 reason: 'response detail error:2,errMsg:post method api body check failed!'
}
node.js api axios agora.io
3个回答
2
投票

这意味着您已成功获得授权,但您传递了错误的值,或者未在您的正文或 URL 中定义该值。 请检查您传递的任何变量是否未定义或包含错误/不完整的值。


0
投票

您应该将标头作为带有授权密钥的对象传递,在您的情况下:

{
   headers: {'Authorization': "Basic " + Authorization}
}

0
投票

确保将

cname
uid
作为字符串传递 - 这是我的情况

© www.soinside.com 2019 - 2024. All rights reserved.