尝试更新视频时范围不足

Unsufficient scope when attempting to update video

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

因此,我正在使用 /file/upload 生成 public 上传 URL,然后使用 /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
    )
);

根据上面的内容,我正在设置 manage_videos 范围,但它仍然报告我没有正确的范围?

谁能指出我哪里出错了?

谢谢

如果您正在通过 manage_videos 范围,但仍然收到提示您没有正确范围的错误,这一定是由于存在会话。

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