我可以使用谷歌API授权服务帐户嵌入日历的iframe?

问题描述 投票:0回答:1

我试图嵌入使用与日历ID嵌入代码的iframe谷歌日历。我创建了一个服务帐户,并授权给有问题的日历这个帐户的访问。

我可以成功地验证使用谷歌API客户端服务的帐户,并可以获取从日历中的事件。但是,我想不出如何进行身份验证,所以我可以显示iframe中。

require_once __DIR__ . '/googleapi/vendor/autoload.php';
$client = new Google_Client();

$client->setApplicationName('Google Calendar API PHP');
$client->setScopes(Google_Service_Calendar::CALENDAR_READONLY);
$client->setAuthConfig('my-credentials.json');
$client->setAccessType('offline');
$service = new Google_Service_Calendar($client);

?>
<iframe src="https://calendar.google.com/calendar/embed?src=calendarId&ctz=Europe%2FCopenhagen" style="border: 0" width="800" height="600" frameborder="0" scrolling="no"></iframe>`

结果只是告诉我,我不能表现出有问题的日历信息。

php iframe google-calendar-api google-api-php-client
1个回答
0
投票

你似乎什么做

<iframe src="https://calendar.google.com/calendar/embed?src=calendarId&ctz=Europe%2FCopenhagen" style="border: 0" width="800" height="600" frameborder="0" scrolling="no"></iframe>

会像你想运行在一个iframe的谷歌日历应用程序。那是行不通的,因为就没有办法为你验证它,我不认为谷歌将允许从一个iframe他们的登录。

什么,你应该做的

你应该把你的应用程序设计日历显示,你想,然后将在iframe应用程序。

<iframe src="https://yourcalendar.application.dk/awsomapp.php" style="border: 0" width="800" height="600" frameborder="0" scrolling="no"></iframe>

服务帐户只是想给你它不会给你访问通过iframe运行谷歌日历网站上的数据访问。

© www.soinside.com 2019 - 2024. All rights reserved.