获取 open_ticket
Scope: open.get.ticket
需要申请权限,不需要用户授权
该接口用于 h5 链接拉起抖音发布器分享视频时对开发者身份进行验签;本接口适用于抖音。
注意
- •抖音的 OAuth API 以
https://open.douyin.com/
开头。- •open_ticket 的有效时间为 2 个小时,重复获取 ticket 后会使上次的 ticket 失效(但有 5 分钟的缓冲时间)。
请求地址
GET /open/getticket/
请求头
- •Content-Type: application/json
- •access-token: 调用 /oauth/client_token/ 接口生成的 token,此 token 不需要用户授权。
示例:"clt.943da17996fb5cebfbc70c044c3fc25a57T54DcjT6HNKGqnUdxzy1KcxGFs"
请求参数
无。
请求样例
curl --location --request GET 'https://open.douyin.com/open/getticket/' \ --header 'access-token: clt.943da17996fb5cebfbc70c044c3fc25a57T54DcjT6HNKGqnUdxzy1KcxGFs' \
响应参数
参数名称 | 参数类型 | 参数描述 | 参数示例 |
extra | struct | | |
logId | string | 标识请求的唯一 id | 202008121419360101980821035705926A |
now | i64 | 毫秒级时间戳 | 1597213176393 |
error_code | i32 | 错误码 | 0 |
description | string | 错误码描述 | |
sub_error_code | i32 | 子错误码 | 0 |
sub_error_description | string | 子错误码描述 | |
data | struct | | |
ticket | string | open_ticket 接口调用凭证 | @bxLdikRXVbTPdHSM05e5u5sUoXNKd8== |
expires_in | i64 | open_ticket 超时时间,单位秒 | 7200 |
响应样例
{ "extra": { "logid": "202008121419360101980821035705926A", "now": 1597213176393, "error_code": 0, "description": "", "sub_error_code": 0, "sub_description": "" }, "data": { "error_code": 0, "description": "", "expires_in": 7200, "ticket": "@haihdoibxLdikRXVbTPdHSM05e5u5sUoXNKd8==" } }
响应错误样例
{ "data": { "error_code": 2100005, "description": "Parameter error", }, "extra": { "error_code": 2100005 "description": "Paramter error", "sub_error_code": 0, "sub_description": "" "now": 1594015876179, "log_id": "2020070614111601022506808001045D59" } }
错误码
错误码 | 描述 | 排查建议 |
2100004 | 系统繁忙,此时请开发者稍后再试 | 检查参数或重试 |
2190004 | 无权访问 | 申请该应用权限 |
16388 | 签名不正确 | 确认获取的 ticket 与校验的 ticket 是否一致 |