【问题标题】:unable to add user in google group, getting an error- "code": 403, "message": "Insufficient Permission"无法在 google 组中添加用户,出现错误-“code”:403,“message”:“Insufficient Permission”
【发布时间】:2018-03-16 08:11:58
【问题描述】:

我无法将用户添加到 Google 群组。我能够生成令牌并将其用于我的日历 API-

  1. 为 G 日历 API 生成的访问令牌是否可用于将用户添加到 Google Group PLS 的过程?
  2. 如果上述步骤为否,那么如何为 Google 群组生成令牌?
  3. 抛出403错误码的原因,错误如下

    "{ "error": 
        { "errors": 
            [ { "domain": "global", "reason": "insufficientPermissions", "message": "Insufficient Permission" } ], 
           "code": 403, "message": "Insufficient Permission" 
        } 
    }"
    
  4. 我正在使用帐户svc.gcalendar@timesinternet.in 进行上述操作,并且我想添加一个用户名devendra.kumarsingh@timesinternet.in

  5. 在 API Explorer 中复制成功,但无法使用我的 api 生成令牌。
  6. 我的代码是

    $groupKey='TIL-Gurgaon@timesinternet.in'; //TIL-Noida@timesinternet.in
    $role='MEMBER';
    $userEmail='devendra.kumarsingh@timesinternet.in';
    $curlPost=array();
    $curlPost = array("email"=>$userEmail,"role"=>$role);       
    $url_events = 'https://www.googleapis.com/admin/directory/v1/groups/'.$groupKey.'/members';     
    $condtion['user_email']='svc.gcalendar@timesinternet.in';
    //Getting Token 
    $datalist=$this->Common->getSingleInfoFromTable('oauth_session',$condtion,'id');
    $access_token=$datalist['access_token'];
    
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url_events);
    //curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
    //xcurl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array('Authorization: Bearer '. $access_token, 'Content-Type: application/json'));
    curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($curlPost));
    $data = json_decode(curl_exec($ch), true);
    $http_code = curl_getinfo($ch,CURLINFO_HTTP_CODE);
    

【问题讨论】:

  • 请将您的帖子限制在一个问题上。
  • 我必须使用 google api 将用户添加到 google 组

标签: php token google-groups google-groups-api


【解决方案1】:

此“通过 api 添加”功能仅适用于订阅了 gsuite 的组织。您能否确认您拥有 GSuite 并使用启用了 GSuite 且有权添加到群组的帐户登录?

https://developers.google.com/admin-sdk/directory/v1/guides/manage-group-members

【讨论】:

    猜你喜欢
    • 2013-10-15
    • 2013-10-25
    • 2016-09-04
    • 1970-01-01
    • 1970-01-01
    • 2018-05-11
    • 2015-12-28
    • 2015-06-04
    • 2015-11-15
    相关资源
    最近更新 更多