我无法将用户添加到 Google 群组。我能够生成令牌并将其用于我的日历 API-
- 为 G Calendar API 生成的访问令牌是否可用于将用户添加到 Google Group PLS 的过程?
- 如果上述步骤为否,那么如何为 Google 群组生成令牌?
使用 403 错误代码引发错误的原因,错误如下
"{ "error": { "errors": [ { "domain": "global", "reason": "insufficientPermissions", "message": "Insufficient Permission" } ], "code": 403, "message": "Insufficient Permission" } }"
我正在使用一个帐户
svc.gcalendar@timesinternet.in
进行上述操作,我想添加一个用户名devendra.kumarsingh@timesinternet.in
- 在 API Explorer 中复制成功,但无法使用我的 api 生成令牌。
我的代码是
$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);