gpt4 book ai didi

php - YouTube Analytics API PHP:usageLimits accessNotConfigured

转载 作者:行者123 更新时间:2023-12-03 05:22:07 24 4
gpt4 key购买 nike

我正在使用wanze的[Google Analytics API PHP]。我能够设置身份验证(仅使用Web身份验证)以及所有内容,并将 token 存储在 session 中。在另一页上,我使用此代码查找用户登录时使用的所有帐户。

session_start();
include('GoogleAnalyticsAPI.class.php');

$ga = new GoogleAnalyticsAPI();
$ga->auth->setClientId('replaces'); // From the APIs console
$ga->auth->setClientSecret('replaces'); // From the APIs console
$ga->auth->setRedirectUri('replaced'); // Url to your app, must match one in the APIs console

// Get the Auth-Url
$url = $ga->auth->buildAuthUrl();

// Set the accessToken and Account-Id
$ga->setAccessToken($_SESSION['accessToken']);
$ga->setAccountId('ga:xxxxxxx');

// Load profiles
$profiles = $ga->getProfiles();
print_r($profiles);
$accounts = array();
foreach ($profiles['items'] as $item) {
$id = "ga:{$item['id']}";
$name = $item['name'];
$accounts[$id] = $name;
}
// Print out the Accounts with Id => Name. Save the Id (array-key) of the account you want to query data.
// See next chapter how to set the account-id.
print_r($accounts);

我这回来了:
Array
(
[http_code] => 403
[error] => Array
(
[errors] => Array
(
[0] => Array
(
[domain] => usageLimits
[reason] => accessNotConfigured
[message] => Access Not Configured. The API is not enabled for your project, or there is a per-IP or per-Referer restriction configured on your API key and the request does not match these restrictions. Please use the Google Developers Console to update your configuration.
[extendedHelp] => https://console.developers.google.com
)

)

[code] => 403
[message] => Access Not Configured. The API is not enabled for your project, or there is a per-IP or per-Referer restriction configured on your API key and the request does not match these restrictions. Please use the Google Developers Console to update your configuration.
)

)
<br />
<b>Warning</b>: Invalid argument supplied for foreach() in <b>/home3/chalzzy/public_html/dashboard/dashboard.php</b> on line <b>21</b><br />
Array
(
)

我在很多地方看到需要在控制台的“引荐”部分中删除或设置所有引用,但是我似乎无法在新旧控制台中找到它。如果有,但找不到,请给我一个网址或屏幕截图吗?

另外,这些是我为此项目安装的所有API:

提前致谢,



另外,如果您需要更多详细信息,请告诉我!

最佳答案

嘿(对不起,这是一个非常愚蠢的问题),

您需要做的是将Developers Console中的“Analytics API”添加到您的API列表中。

关于php - YouTube Analytics API PHP:usageLimits accessNotConfigured,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27623007/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com