后试图相当不错的,而这样做是正确..
添加下列文件到我的客户端文件夹
Accounts.ui.config({requestPermissions: {google:
['https://www.googleapis.com/auth/calendar',
'https://www.googleapis.com/auth/userinfo.profile',
'https://www.googleapis.com/auth/tasks']}}, requestOfflineToken: {google: true})
gCal =
insertEvent: (cliente, poblacion, texto, fecha)->
#to-do calendar devuelve un Event Object que incluye un ID
# si incluimos este id como campo en la alerta podremos despues
# eliminar el evento en el calendario directamente desde la app
url = "https://www.googleapis.com/calendar/v3/calendars/primary/events"
event= {
summary: cliente
location: poblacion
description: texto
start:
"date": fecha
end:
"date": fecha
}
evento = JSON.stringify event
console.log evento
Auth = 'Bearer ' + Meteor.user().services.google.accessToken
Meteor.http.post url, {
params: {key: 'INSERT-YOUR-API-KEY-HERE'},
data: event,
headers: {'Authorization': Auth }
},
(err, result)->
console.log result
return result.id
,如果你登录直通{{loginButtons}},然后调用insertEvent它奇迹般有效。
嘿,呃,请接受你的问题更多的答案。在这里接受答案被认为是礼貌的,它有助于增加你在将来得到好答案的机会。 – Rahul
我很乐意接受问题的答案,不仅它很有礼貌,而且也是我认为该网站的目标,但我觉得这是一个很好的答案,不完全解决问题对任何人都没有好处谁会寻找类似的问题。我回顾了我的所有问题(不是很多),并检查了一个很好的答案。谢谢你的评论 :) – Perseoh