【发布时间】:2018-03-16 08:11:58
【问题描述】:
我无法将用户添加到 Google 群组。我能够生成令牌并将其用于我的日历 API-
- 为 G 日历 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);
【问题讨论】:
-
请将您的帖子限制在一个问题上。
-
我必须使用 google api 将用户添加到 google 组
标签: php token google-groups google-groups-api