【问题标题】:Invalid refresh token无效的刷新令牌
【发布时间】:2018-09-13 14:35:43
【问题描述】:

开发者。

我无法将视频上传到 Dailymotion。第一次上传有效,当我尝试发送第二个视频时,我收到一条错误消息,依此类推,一个视频被发送,另一个视频失败。错误信息是:

“无效的刷新令牌”

我的代码

$url = $request->file("file");
$api = new Dailymotion();
$api->setGrantType(
Dailymotion::GRANT_TYPE_PASSWORD,
"xxxxxxxxx",
"xxxxxxxx",
array("manage_videos","userinfo","manage_playlists","manage_user_settings","manage_applications"),
array(
"username" => "xxx@xxx.com.br",
"password" => "xxx",
));
$api->logout();
$videoUrl = $api->uploadFile($url);

$result = $api->post(
"/me/videos",
array("url" => $videoUrl, "title" =>"teste de vídeo"
));

【问题讨论】:

  • 我不熟悉他们的 API,但您似乎不应该在上传文件并发布之前调用 logout()
  • 如果我更改地点注销,它不会上传视频,我会收到类似的错误。未经授权的应用程序。

标签: php api


【解决方案1】:

像这样更改您的代码:

$url = $request->file("file");
$api = new Dailymotion();
$api->setGrantType(Dailymotion::GRANT_TYPE_PASSWORD,"xxxxxxxxx","xxxxxxxx",array("manage_videos","userinfo","manage_playlists","manage_user_settings","manage_applications"),
array("username" => "xxx@xxx.com.br","password" => "xxx",));
$videoUrl = $api->uploadFile($url);

$result = $api->post(
"/me/videos",
array("url" => $videoUrl, "title" =>"teste de vídeo"
));

$api->logout();

【讨论】:

    猜你喜欢
    • 2021-11-01
    • 1970-01-01
    • 2018-04-03
    • 2020-06-13
    • 2023-02-02
    • 1970-01-01
    • 2017-12-25
    • 2021-12-17
    • 2020-02-12
    相关资源
    最近更新 更多