我尝试从TikTok oauth2端点获取refresh_token,但由于某种原因,它返回
"code" => 40115
"message" => "Timestamp has expired."
我所做的是从应用管理面板中获取auth链接,然后返回到重定向URL并调用open_API/v1.3/oauth2/creator_token/?business=tt_user endpoint,具有client_id、client_secret、grant_type、auth_code,但我总是得到相同的消息。而且,如果我检查标题,它说一个即时日期。怎么会这样?
public function callback(Request $request)
{
$accessTokenUrl = 'https://business-api.tiktok.com/open_api/v1.3/oauth2/creator_token/?business=tt_user';
$response = Http::withHeaders([
'Content-Type' => 'application/json',
])->post($accessTokenUrl, [
"client_id" => env('TIKTOK_CLIENT_ID'),
"client_secret" => env('TIKTOK_CLIENT_SECRET'),
"grant_type" => "authorization_code",
"auth_code" => $request['auth_code']
]);
if($response->successful()) {
dump($response->headers());
dd($response->json());
} else {
dump($response->headers());
dd($response->json());
}
}
1条答案
按热度按时间lbsnaicq1#
我使用相同的方法获得认证链接,并通过tiktok API调用访问令牌,并面临着与您相同的问题,请让我知道,如果您设法解决这个问题,谢谢!