1
我正在嘗試使用API創建Google日曆事件......但是我在嘗試創建活動時遇到錯誤..我成功獲取訪問令牌但無法創建日曆活動...創建Google日曆事件時獲取的權限不足?
請幫忙我試圖從最近2天內解決這個問題......我認爲這是一些問題......我正在使用範圍以下。
任何幫助將不勝感激。
String scope ='https://www.googleapis.com/auth/calendar';
Http h = new Http();
string calendarId='[email protected]';
string url='https://www.googleapis.com/calendar/v3/calendars/'+calendarId+'/events';
string body='{"end":{"date": "2013-06-21"},"start":{"date": "2013-06-20"}}';
HttpRequest req=new HttpRequest();
System.debug('-----accesstokenvvvvvvvv---'+accesstoken);
req.setHeader('Authorization','Bearer '+accesstoken);
req.setHeader('Content-Type', 'application/json');
req.setEndpoint(url);
req.setBody(body);
System.debug('-----body---'+body);
req.setMethod('POST');
HttpResponse res;
res = h.send(req);
string data=res.getBody();
System.debug('--------data----'+data);
我得到的錯誤響應
{
"error": {
"errors": [
{
"domain": "global",
"reason": "insufficientPermissions",
"message": "Insufficient Permission"
}
],
"code": 403,
"message": "Insufficient Permission"
}
}
可能是http://stackoverflow.com/questions/16970917/why-is-google-calendar-api-oauth2-responding-with-insufficient-ermission –