I want to get a user's Youtube profile through the gData API
After successfully requesting a token, I run this code, but get a 401 error - user authntication required
<?php
//Get Token
if (isset( $_GET['token'])) {
$token = $_GET['token'];
}
//Authorise
header('Authorization: AuthSub token="' . $token . '"' );
header('X-GData-Key: key="my_developer_key" ');
//Request profile
echo file_get_contents("http://gdata.youtube.com/feeds/api/users/default") ;
?>
Still get the same error though
This is what they're asking for:
When you make an authenticated API request using an AuthSub authentication token, your request needs to specify the Authorization HTTP request header as shown in the example below. Note: In this document, sample requests use AuthSub syntax unless otherwise specified.
Authorization: AuthSub token=<authentication_token>
X-GData-Key: key=<developer_key>
Am I doing the right thing with the headers at all?