postman Tiktok OAuth v2请求参数格式错误

3hvapo4f  于 8个月前  发布在  Postman
关注(0)|答案(1)|浏览(111)

尝试从Tiktok的API从v1迁移到v2端点。目前版本1对我有效,但我对https://open.tiktokapis.com/v2/oauth/token/端点的请求不断返回

{
    "error": "invalid_request",
    "error_description": "The request parameters are malformed.",
    "log_id": "202308141814065FE27A58513347021AF1"
}

我正在通过Postman测试这个,这里是我的请求的截图:

用于获取传递到postman请求中的“代码”的url是https://www.tiktok.com/v2/auth/authorize/?client_key=abcdefg&scope=user.info.basic,user.info.profile,user.info.stats,video.list&response_type=code&state=abcdefg&redirect_uri=https://www.test.com/redirect
我已经向Tiktok请求了对log_id的支持,他们说这是因为“请求中没有设置授权类型”。我在Postman的头中使用了applicable/x-www-form-urlencoded,所以如果这是问题所在,我不知道还需要修改什么。

cx6n0qe3

cx6n0qe31#

我认为你的问题是因为你在queryparams中传递参数,它们必须在body params中

你也可以尝试在postman中导入这个curl,它在官方文档中:

curl --location --request POST 'https://open.tiktokapis.com/v2/oauth/token/' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Cache-Control: no-cache' \
--data-urlencode 'client_key=CLIENT_KEY' \
--data-urlencode 'client_secret=CLIENT_SECRET' \
--data-urlencode 'code=CODE' \
--data-urlencode 'grant_type=authorization_code' \
--data-urlencode 'redirect_uri=REDIRECT_URI'

参考:https://developers.tiktok.com/doc/oauth-user-access-token-management

相关问题