第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

訂閱列表 YouTube API

訂閱列表 YouTube API

PHP
慕碼人2483693 2023-09-22 14:47:39
使用 Google API,我希望檢索我從 Youtube 帳戶訂閱的頻道列表。為此,我使用了以下 PHP 庫:https://packagist.org/packages/league/oauth2-client。應(yīng)用所有必要的信息后,我收到以下錯(cuò)誤:致命錯(cuò)誤:未捕獲的 UnexpectedValueException:從授權(quán)服務(wù)器收到的響應(yīng)無效。預(yù)期的 JSON ....這是我的代碼:<?phprequire 'vendor/autoload.php';$provider = new \League\OAuth2\Client\Provider\GenericProvider([    'clientId'                => 'my_oauth_client_id',    // The client ID assigned to you by the provider    'clientSecret'            => 'my_oauth_client_secret',   // The client password assigned to you by the provider    'redirectUri'             => 'http://localhost/oauthytb/index.php',    'urlAuthorize'            => 'https://accounts.google.com/o/oauth2/v2/auth',    'urlAccessToken'          => 'https://oauth2.googleapis.com/token',    'urlResourceOwnerDetails' => 'https://www.googleapis.com/auth/youtube.readonly']);// If we don't have an authorization code then get oneif (!isset($_GET['code'])) {    $options = [        'scope' => ['https://www.googleapis.com/auth/youtube.readonly']    ];        // Fetch the authorization URL from the provider; this returns the    // urlAuthorize option and generates and applies any necessary parameters    // (e.g. state).    $authorizationUrl = $provider->getAuthorizationUrl($options);    // Get the state generated for you and store it to the session.    $_SESSION['oauth2state'] = $provider->getState();    // Redirect the user to the authorization URL.    header('Location: ' . $authorizationUrl);    exit;// Check given state against previously stored one to mitigate CSRF attack} elseif (empty($_GET['state']) || (isset($_SESSION['oauth2state']) && $_GET['state'] !== $_SESSION['oauth2state'])) {    if (isset($_SESSION['oauth2state'])) {        unset($_SESSION['oauth2state']);    }        exit('Invalid state');} 
查看完整描述

1 回答

?
慕運(yùn)維8079593

TA貢獻(xiàn)1876條經(jīng)驗(yàn) 獲得超5個(gè)贊

我終于解決了這個(gè)問題。

我更換了:

'urlResourceOwnerDetails' => 'https://www.googleapis.com/auth/youtube.readonly'

經(jīng)過 :

'urlResourceOwnerDetails' => 'https://www.googleapis.com/youtube/v3/subscriptions?part=snippet%2CcontentDetails&mine=true&key=AIzaSyDay5KNU_TPCD-s_n7t6XqqrHYumUtjytI'



查看完整回答
反對 回復(fù) 2023-09-22
  • 1 回答
  • 0 關(guān)注
  • 115 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)