获取Token
SDK到Pano Cloud的所有交互都需要Token,Token可以使用下面的RESTful API获取。
请求
POST /auth/token
Host: api.pano.video
Content-Type: application/json
Authorization: PanoSign <PanoSign>
Tracking-Id: ef9b2acc8e1f4d598090eb6d9cbe8596
{
"userId": "1234", //String 必填,用户ID,实际值为UINT64数值
"channelId": "1234", //String 必填,频道ID
"duration": 86400, //int 可选,token有效期,单位为秒,默认24小时
"channelDuration": 60, //int 可选,会议最长时长,单位为分钟,0表示不限时长
"privileges": 0 //int 可选,权限
"size": 20 //int 可选,房间最多人数
}
参数说明:
- channelDuration - 如果你想限制通话时长,可以使用此参数,当时间到时Pano会自动结束通话,通话最长时长由加入通话的第一个人确定;如果你不想限制通话时长,可以不传入此参数,或者参数值为0。关于最长通话时长说明可以参考这里
- privileges - 具体含义请参考Token Privileges
- duration - token有效期,单位为秒,默认最长24小时,如果有特殊需求,请联系商务
- size - 可选,房间支持的最多人数,默认最大25,如果有特殊需求,请联系商务
响应码描述:
HTTP状态码 | 错误码 | 描述 |
---|---|---|
200 | 正常返回 | |
403 | Authentication.Type.Invalid | HTTP请求头Authentication类型不对 |
403 | Authentication.Signature.Invalid | HTTP请求头Authentication 值有误,请检查signature签名信息 |
403 | App.Status.Error | app 状态可能不对,请到控制台检查app是否禁用 |
403 | Org.Status.Error | 公司信息状态不对,请检查是否欠费 |
403 | Invalid.Parameter.Value | 请求参数不合法,请检查是否按文档规定传递参数 |
404 | InvalidEntity.NotFound | app 信息找不到,请查看appId是否正确 |
406 | App.Secret.Empty | app Secret 信息有误,请到控制台获取正确app Secret |
406 | Pano.Sign.Error | 请检查PanoSign 是否按照规定生成签名信息 |
500 | Server.Error | 服务器内部出错 |
响应示例:
请求正常处理并返回:
200 OK
{
"token": "011A11NEpXMTZzamXY2mZmpsoZSVhxoo0n9309nK0PjnryITSbdIpHf1JSekIkoYPKyYODyHHgYqTRcKDQtkFchk7Kz7ITu764UX/aBlSvtLxcS2CUle4WA5JFUN/nqC2Tzi7nX/"
}
各种错误返回:
403 AuthenticationTypeError
{
"error": "Authentication.Type.Invalid",
"msg": "your authentication type is invalid"
}
403 AuthenticationSignatureError
{
"error": "Authentication.Signature.Invalid",
"msg": "your authentication signature is invalid"
}
403 AppStatusError
{
"error": "App.Status.Error",
"msg": "your app status is not correct"
}
403 OrgStatusError
{
"error": "Org.Status.Error",
"msg": "your organization status is abnormality"
}
404 EntityNotFoundError
{
"error": "InvalidEntity.NotFound",
"msg": "could not find this entity"
}
406 AppSecretEmptyError
{
"error": "App.Secret.Empty",
"msg": "your appSecret is empty"
}
406 PanoSignError
{
"error": "Pano.Sign.Error",
"msg": "fix your PanoSign value"
}
500 ServerError
{
"error": "Server.Error",
"msg": "server error, please contact the administrator"
}