本文包含 Google Calendar API 專屬的授權和驗證資訊。閱讀本文前,請務必先參閱「瞭解驗證和授權」,瞭解 Google Workspace 的一般驗證和授權資訊。
設定 OAuth 2.0 授權
設定 OAuth 同意畫面並選擇範圍,定義向使用者和應用程式審查人員顯示的資訊,然後註冊應用程式,以便日後發布。
Calendar API 範圍
如要定義授予應用程式的存取層級,您需要識別並宣告授權範圍。授權範圍是 OAuth 2.0 URI 字串,包含 Google Workspace 應用程式名稱、存取資料類型和存取層級。「範圍」是指應用程式要求存取 Google Workspace 資料,包括使用者 Google 帳戶資料。
安裝應用程式時,系統會要求使用者驗證應用程式使用的範圍。一般來說,您應盡可能選擇範圍最窄的範圍,並避免要求應用程式不需要的範圍。使用者更願意授予存取權給範圍有限且說明清楚的應用程式。
Calendar API 支援下列範圍:
範圍 | 意義 |
---|---|
https://www.googleapis.com/auth/calendar |
查看、編輯、共用及永久刪除您透過 Google 日曆存取的所有日曆。 |
https://www.googleapis.com/auth/calendar.readonly |
您可透過 Google 日曆查看及下載任何您能存取的日曆。 |
https://www.googleapis.com/auth/calendar.freebusy |
在您的日曆中查看您有空與否。 |
https://www.googleapis.com/auth/calendar.events |
查看及編輯所有日曆上的活動。 |
https://www.googleapis.com/auth/calendar.events.readonly |
查看所有日曆上的活動。 |
https://www.googleapis.com/auth/calendar.settings.readonly |
查看日曆設定。 |
https://www.googleapis.com/auth/calendar.addons.execute |
做為 Google 日曆外掛程式使用。 |
https://www.googleapis.com/auth/calendar.addons.current.event.read |
查看您在 Google 日曆中開啟的活動。 |
https://www.googleapis.com/auth/calendar.addons.current.event.write |
編輯您在 Google 日曆中開啟的活動。 |
https://www.googleapis.com/auth/calendar.events.owned |
查看、建立、變更及刪除由您擁有的 Google 日曆上顯示的活動。 |
https://www.googleapis.com/auth/calendar.events.owned.readonly |
查看由您擁有的 Google 日曆上顯示的活動。 |
https://www.googleapis.com/auth/calendar.events.freebusy |
查看您可存取的 Google 日曆上顯示的「有空與否」相關資訊。 |
https://www.googleapis.com/auth/calendar.app.created |
製作次要 Google 日曆,以及查看、建立、變更及刪除這些日曆上的活動。 |
https://www.googleapis.com/auth/calendar.calendarlist |
查看、新增及移除您已訂閱的 Google 日曆。 |
https://www.googleapis.com/auth/calendar.calendarlist.readonly |
查看您訂閱的 Google 日曆清單。 |
https://www.googleapis.com/auth/calendar.calendars |
查看及變更您可存取的 Google 日曆的屬性,以及建立次要日曆。 |
https://www.googleapis.com/auth/calendar.calendars.readonly |
查看您可存取的 Google 日曆的標題、說明、預設時區和其他屬性。 |
https://www.googleapis.com/auth/calendar.acls |
查看及變更由您擁有的 Google 日曆的共用權限。 |
https://www.googleapis.com/auth/calendar.acls.readonly |
查看您擁有的 Google 日曆的共用權限。 |
https://www.googleapis.com/auth/calendar.events.public.readonly |
查看公開日曆上的活動。 |