CalendarList:列表不返回日历列表
CalendarList: list not returning list of calendars
我正在尝试从 google api:
获取用户日历列表
async function main() {
const client = new google.auth.JWT(
privatekey.client_email,
null,
privatekey.private_key,
["https://www.googleapis.com/auth/calendar"]
);
const url = 'https://www.googleapis.com/calendar/v3/users/me/calendarList';
const res = await client.request({ url });
console.log(res.data);
}
我得到一个空的 items
数组:
info: { kind: 'calendar#calendarList',
etag: '"p3000"',
nextSyncToken:
'CAASPWdvb2dsZWNhbGVuZGFyc2VydmljZUBldmVudGFwaS0yMTkwMTEuaWFtLmdzZXJ2aWNlYWNjb3VudC5jb20=',
items: [] }
info: { kind: 'calendar#calendarList',
etag: '"p3000"',
nextSyncToken:
'CAASPWdvb2dsZWNhbGVuZGFyc2VydmljZUBldmVudGFwaS0yMTkwMTEuaWFtLmdzZXJ2aWNlYWNjb3VudC5jb20=',
items: [] }
当我使用 api 资源管理器时,我可以获得我需要的日历列表。我有什么想法可以获取日历列表吗?
配置:
{
"type": "service_account",
"project_id": "xx",
"private_key_id": "xxx",
"private_key": "-----BEGIN PRIVATE KEY-----xxxn-----END PRIVATE KEY-----\n",
"client_email": "googlecalendarservice@eventapi-219011.iam.gserviceaccount.com",
"client_id": "111757078202416067272",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/googlecalendarservice%40eventapi-219011.iam.gserviceaccount.com"
}
需要授予服务帐户访问每个日历的权限。
我正在尝试从 google api:
获取用户日历列表async function main() {
const client = new google.auth.JWT(
privatekey.client_email,
null,
privatekey.private_key,
["https://www.googleapis.com/auth/calendar"]
);
const url = 'https://www.googleapis.com/calendar/v3/users/me/calendarList';
const res = await client.request({ url });
console.log(res.data);
}
我得到一个空的 items
数组:
info: { kind: 'calendar#calendarList',
etag: '"p3000"',
nextSyncToken:
'CAASPWdvb2dsZWNhbGVuZGFyc2VydmljZUBldmVudGFwaS0yMTkwMTEuaWFtLmdzZXJ2aWNlYWNjb3VudC5jb20=',
items: [] }
info: { kind: 'calendar#calendarList',
etag: '"p3000"',
nextSyncToken:
'CAASPWdvb2dsZWNhbGVuZGFyc2VydmljZUBldmVudGFwaS0yMTkwMTEuaWFtLmdzZXJ2aWNlYWNjb3VudC5jb20=',
items: [] }
当我使用 api 资源管理器时,我可以获得我需要的日历列表。我有什么想法可以获取日历列表吗?
配置:
{
"type": "service_account",
"project_id": "xx",
"private_key_id": "xxx",
"private_key": "-----BEGIN PRIVATE KEY-----xxxn-----END PRIVATE KEY-----\n",
"client_email": "googlecalendarservice@eventapi-219011.iam.gserviceaccount.com",
"client_id": "111757078202416067272",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/googlecalendarservice%40eventapi-219011.iam.gserviceaccount.com"
}
需要授予服务帐户访问每个日历的权限。