0
根據文檔https://developers.google.com/youtube/registering_an_application 據說,爲了獲得令牌,我們需要發送一個客戶端ID和一個客戶端密鑰,所以我是完成該代碼部分,當我運行代碼時,代碼是空的。無法獲取令牌youtube-data-api
require_once 'Google/Client.php';
require_once 'Google/Service/YouTube.php';
session_start();
$OAUTH2_CLIENT_ID = 'myclientid';
$OAUTH2_CLIENT_SECRET = 'mysecreatID';
$client = new Google_Client();
$client->setClientId($OAUTH2_CLIENT_ID);
$client->setClientSecret($OAUTH2_CLIENT_SECRET);
$client->setScopes('https://www.googleapis.com/auth/youtube');
$redirect = filter_var('http://youtubeupload.net/update_video.php',
FILTER_SANITIZE_URL);
$client->setRedirectUri($redirect);
echo 'token: '.$client->getAccessToken(); //No token is displayed
die();