<tfoot id='VGgkU'></tfoot>
        <bdo id='VGgkU'></bdo><ul id='VGgkU'></ul>
      1. <small id='VGgkU'></small><noframes id='VGgkU'>

        <i id='VGgkU'><tr id='VGgkU'><dt id='VGgkU'><q id='VGgkU'><span id='VGgkU'><b id='VGgkU'><form id='VGgkU'><ins id='VGgkU'></ins><ul id='VGgkU'></ul><sub id='VGgkU'></sub></form><legend id='VGgkU'></legend><bdo id='VGgkU'><pre id='VGgkU'><center id='VGgkU'></center></pre></bdo></b><th id='VGgkU'></th></span></q></dt></tr></i><div id='VGgkU'><tfoot id='VGgkU'></tfoot><dl id='VGgkU'><fieldset id='VGgkU'></fieldset></dl></div>
        <legend id='VGgkU'><style id='VGgkU'><dir id='VGgkU'><q id='VGgkU'></q></dir></style></legend>

      2. 从 Google 服务帐户编辑 Google 日历事件:403

        Edit Google calendar events from Google service account: 403(从 Google 服务帐户编辑 Google 日历事件:403)
      3. <legend id='CaVL7'><style id='CaVL7'><dir id='CaVL7'><q id='CaVL7'></q></dir></style></legend>
        • <tfoot id='CaVL7'></tfoot>

        • <i id='CaVL7'><tr id='CaVL7'><dt id='CaVL7'><q id='CaVL7'><span id='CaVL7'><b id='CaVL7'><form id='CaVL7'><ins id='CaVL7'></ins><ul id='CaVL7'></ul><sub id='CaVL7'></sub></form><legend id='CaVL7'></legend><bdo id='CaVL7'><pre id='CaVL7'><center id='CaVL7'></center></pre></bdo></b><th id='CaVL7'></th></span></q></dt></tr></i><div id='CaVL7'><tfoot id='CaVL7'></tfoot><dl id='CaVL7'><fieldset id='CaVL7'></fieldset></dl></div>

                • <bdo id='CaVL7'></bdo><ul id='CaVL7'></ul>
                    <tbody id='CaVL7'></tbody>

                  <small id='CaVL7'></small><noframes id='CaVL7'>

                  本文介绍了从 Google 服务帐户编辑 Google 日历事件:403的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我想通过服务帐户在 google 日历上创建新事件.我可以正确访问并打印我所有日历的列表.但是当我想创建一个新事件时,响应是 403 Forbidden.

                  I want to create new event at google calendar from Service Account. I can access correctly and print a list all my calendars. But when I want to create a new event the response is 403 Forbidden.

                  我的代码:

                  require_once 'src/Google_Client.php';
                  require_once 'src/contrib/Google_CalendarService.php';
                  
                  session_start();
                  
                  const CLIENT_ID = 'XXXXXXXXXX.apps.googleusercontent.com';
                  const SERVICE_ACCOUNT_NAME = 'XXXXXXXXXXXX@developer.gserviceaccount.com';
                  
                  const KEY_FILE = 'google_src/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-privatekey.p12';
                  
                  $client = new Google_Client();
                  $client->setApplicationName("APP_NAME");
                  
                  if (isset($_SESSION['token'])) {
                   $client->setAccessToken($_SESSION['token']);
                  }
                  
                  $key = file_get_contents(KEY_FILE);
                  $client->setClientId(CLIENT_ID);
                  $client->setAssertionCredentials(new Google_AssertionCredentials(
                    SERVICE_ACCOUNT_NAME,
                    'https://www.google.com/calendar/feeds/MY_CALENDAR_ID/private/full/',
                    $key)
                  );
                  
                  $client->setClientId(CLIENT_ID);
                  $cal = new Google_CalendarService($client);
                  $event = new Google_Event();
                  $event->setSummary('Bon dia pel matí!');
                  $event->setLocation('Somewhere');
                  $start = new Google_EventDateTime();
                  $start->setDateTime('2012-08-06T10:00:00.000-07:00');
                  $event->setStart($start);
                  $end = new Google_EventDateTime();
                  $end->setDateTime('2012-09-06T10:25:00.000-07:00');
                  $event->setEnd($end);
                  
                  $createdEvent = $cal->events->insert(CALENDAR_NAME, $event);
                  

                  和服务器响应:

                  (403) Forbidden
                  

                  有什么想法吗?也许其他范围,或允许编辑事件(我不知道我可以在哪里配置它,我已经搜索过了,承诺)

                  Any ideas? Maybe other scope, or allow edit events (I dont know where I can configure this and I have searched it, promise)

                  当然,我的日历是公共日历.

                  Of course, my calendar is a public calendar.

                  欢迎任何帮助:)

                  谢谢!

                  推荐答案

                  我解决了,问题不是代码,它工作正常.

                  I solved it, and the issue was not code, It works fine.

                  问题在于共享我的日历.一些我不知道的东西.

                  The problem was sharing my calendar. Something that I don't knew.

                  要允许从服务帐户编辑您的日历事件,您在 Google Api 控制台中执行的所有步骤都不够,您必须从您的日历配置(日历配置 -> 共享此日历)中授予电子邮件帐户的权限指定到 Google Api 控制台(电子邮件地址).

                  To allow edit your calendar events from service account, do not have enough with all steps you do in the Google Api Console, you have to give permission from your calendar configuration (Calendar configuration -> Share this calendar) to the email account specified into Google Api Console (email adress).

                  如果是企业帐户,这可能会出现问题,那么您必须联系帐户管理员.

                  This can be a problem if it's a business account, then you will have to contact the account administrator.

                  此处显示的代码可以正常工作,所以我希望它对某人有所帮助,但请记住,您必须使用 475 版本的 Google Api 客户端.

                  The code shown here works correctly, so I hope it helps someone, just remember that you must use 475 version of the Google Api Client.

                  您可以在此链接中找到:http://google-api-php-client.googlecode.com/svn/trunk/src/

                  这篇关于从 Google 服务帐户编辑 Google 日历事件:403的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                  PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                  mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                  Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                  Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                  Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)
                        <bdo id='su39f'></bdo><ul id='su39f'></ul>
                        <tfoot id='su39f'></tfoot>
                          <tbody id='su39f'></tbody>

                        1. <small id='su39f'></small><noframes id='su39f'>

                          <legend id='su39f'><style id='su39f'><dir id='su39f'><q id='su39f'></q></dir></style></legend>

                        2. <i id='su39f'><tr id='su39f'><dt id='su39f'><q id='su39f'><span id='su39f'><b id='su39f'><form id='su39f'><ins id='su39f'></ins><ul id='su39f'></ul><sub id='su39f'></sub></form><legend id='su39f'></legend><bdo id='su39f'><pre id='su39f'><center id='su39f'></center></pre></bdo></b><th id='su39f'></th></span></q></dt></tr></i><div id='su39f'><tfoot id='su39f'></tfoot><dl id='su39f'><fieldset id='su39f'></fieldset></dl></div>