流星Google日历权限不足

时间:2018-08-24 11:20:11

标签: meteor google-api google-calendar-api

我尝试访问Google日历时权限不足。我正在使用客户端代码:

  

Meteor.loginWithGoogle({requestPermissions:['https://www.googleapis.com/auth/calendar'],forceApprovalPrompt:true,requestOfflineToken:true});

AND

  

Accounts.ui.config({requestPermissions:{google:['https://www.googleapis.com/auth/calendar']},forceApprovalPrompt:{google:true},requestOfflineToken:{google:true}});

和服务器端

Meteor.methods({
 getCalendar: function (arg) {

var user= Meteor.users.findOne({_id: this.userId});
GoogleApi.get('calendar/v3/calendars/primary/events', {
  user: user,
  params: {
    'calendarId': 'primary',
    'timeMin': new Date().toISOString(),
    // 'timeMax': new Date(new Date().setFullYear(new Date().getFullYear() + 1)).toISOString(),
    'showDeleted': false,
    'singleEvents': true,
    'orderBy': 'startTime',
    'access_type': 'offline'
  }
}, function (error, result) {
   console.log(result);
 /* if(error){
    console.error(error);
  }*/
});
 },


});
  

错误:    {错误:   {错误:[[对象]],    代码:403,    消息:“权限不足”}}

所以,请告诉我如何访问Google日历

0 个答案:

没有答案