twitchdev / issues

Issue tracker for third party developers.
Apache License 2.0
72 stars 7 forks source link

Collections API 401 - first-party oauth client required #252

Closed BarryCarlyon closed 11 months ago

BarryCarlyon commented 3 years ago

Brief description

The collections API is returning a 401 with first-party oauth client required

{"error":"Unauthorized","status":401,"message":"first-party oauth client required"}

How to reproduce

Try to get a Collection Try to add a video to a collection

Expected behavior

The calls work as expected

Example code using PHP today

<?php

    $ch = curl_init('https://api.twitch.tv/kraken/collections/'
        . $collection_id . '/items');
    curl_setopt($ch, CURLOPT_HTTPHEADER, array(
        'Accept: application/vnd.twitchtv.v5+json',
        'Client-ID: ' . $client_id,
        'Authorization: OAuth ' . $token,
        'Content-Type: application/json'
    ));

    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(array(
        'id' => 'somevideoID',
        'type' => 'video'
    )));

    $r = curl_exec($ch);
    $i = curl_getinfo($ch);
    curl_close($ch);

    print_r($i['http_code']);
    print_r($r);
iProdigy commented 3 years ago

Able to replicate this for all the collections endpoints that require authentication.

In addition, for Get Collection, if I set include_all_items to true and pass my token, I get: {"error":"Unauthorized","status":401,"message":"first-party oauth client required"}. But, after passing the first-party token, I get: {"error":"Not Found","status":404,"message":"This API does not exist"}. The other collections endpoints did work after passing the first-party token.

Xemdo commented 11 months ago

Closing due to the deprecation of the Kraken API as of February 2023.