尝试更新视频时范围不足

时间:2016-01-11 12:15:07

标签: php dailymotion-api

我目前正在制作一个项目,允许员工通过管理界面将视频上传到DailyMotion,而无需自己触摸DailyMotion(视频已嵌入我们的网站,但托管在DM上。)

因此,我使用$(function() { var lengthText = 10; var text = $('#test').text(); var shortText = $.trim(text).substring(0, lengthText).split(" ").slice(0, -1).join(" ") + "..."; $('#test').prop("title", text); $('#test').text(shortText); $('[data-toggle="tooltip"]').tooltip(); }) 生成公开上传网址,然后使用/file/upload发布视频并设置一些设置。

/me/videos

从上面开始,我正在设置// Initiatlise and authenticate. $api = new Dailymotion(); $api->setGrantType( Dailymotion::GRANT_TYPE_PASSWORD, 'api_key', 'api_key_secret', array( 'write', 'delete', 'manage_videos' ), array( 'username' => 'username', 'password' => 'password' ) ); // Get public upload/progress urls. $urls = $api->get('/file/upload'); // Upload result with video URL. $upload_result = { acodec: "AAC", bitrate: 1248721, dimension: "1280x720", duration: 13504, format: "MPEG-4", hash: "...", name: "...", seal: "...", size: 2107842, streamable: "No", url: "...", vcodec: "AVC" }; // Update video to set published etc. $result = $api->post( '/me/videos', array( 'url' => $upload_result->url, 'title' => 'Some title', 'publish' => true ) ); 范围并且仍在报告我没有正确的范围?

有谁可以指出我哪里出错?

由于

1 个答案:

答案 0 :(得分:1)

如果您通过了manage_videos范围并仍然收到错误提及您没有正确的范围,则必须归功于现有会话。

OAuth 2.0的一个问题是规范没有提供任何升级现有会话范围的机制。要将新范围添加到现有会话,首先需要调用Dailymotion::logout()方法并使用新的范围列表开始新会话(请参阅https://developer.dailymotion.com/tools/sdks#sdk-php-authentication处提及此处的说明)。

相关问题