【Google Calendar API v3】get events list with OAuth 2.0 &
It took me some time to learn about the Google Calendar API V3 and I have encountered some problems. So it is necessary to summary the steps, just take the 'event list' as an example. The event list API is here:https://developers.google.co
It took me some time to learn about the Google Calendar API V3 and I have encountered some problems. So it is necessary to summary the steps, just take the 'event list' as an example.
The event list API is here: https://developers.google.com/google-apps/calendar/v3/reference/events/list
Details of using OAuth 2.0 for Login is here: https://developers.google.com/accounts/docs/OAuth2Login
Assumption: you have alreay registered your app and turn the Calendar API 'ON' in the 'API & auth' sidebar.
Note: The request needs authorization and I use OAuth 2.0, here are the steps.
Step 1. Send an Authentication Request to Google
HTTP GET: https://accounts.google.com/o/oauth2/auth?
client_id=XXXXXXXXX&
response_type=code&
scope=https://www.googleapis.com/auth/calendar&
redirect_uri=XXXXXXXXX&
login_hint=XXXXXX
client_id: can be seen in your Google Cloud Console.
redirect_uri: also in your Google Cloud Console, you must write it down in your registered apps page.
login_hint=google account
Then your will find the code parameter in the redirect uri.
Step 2. Exchange Code for Access Token and ID Token
Use the code you got in the last step to post request. The actual request might look like:
<span>POST /o/oauth2/token HTTP/1.1 Host: accounts.google.com Content-Type: application/x-www-form-urlencoded code=4/P7q7W91a-oMsCeLvIaQm6bTrgtp7& client_id=8819981768.apps.googleusercontent.com& client_secret={client_secret}& redirect_uri=https://oauth2-login-demo.appspot.com/code& grant_type=authorization_code</span>
I use the Chrome Plugin Rest Client to post the request and get access token.
Then you will get the access_token in the response.
Step 3. Get Events List NOW!
With the access_token, you are able to request the event list according to Google Calendar API.The whole HTTP GET URI is like:
https://www.googleapis.com/calendar/v3/calendars/{your calendar id}/events?
code=XXXXXX&
client_id=XXXXXX&
client_secret=XXXXXX&
redirect_uri=XXXXX&
grant_type=authorization_code
&access_token=XXXXXXXX
{your calendar id} is your google account, looks like XXX@gmail.com
Then you will get the JSON response!

热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

Video Face Swap
使用我们完全免费的人工智能换脸工具轻松在任何视频中换脸!

热门文章

热工具

记事本++7.3.1
好用且免费的代码编辑器

SublimeText3汉化版
中文版,非常好用

禅工作室 13.0.1
功能强大的PHP集成开发环境

Dreamweaver CS6
视觉化网页开发工具

SublimeText3 Mac版
神级代码编辑软件(SublimeText3)

热门话题

目前,四款新 Pixel 智能手机预计将于今年秋季上市。回顾一下,据传该系列将在发布时推出 Pixel 9 和 Pixel 9 Pro。然而,Pixel 9 Pro 将成为 iPhone 16 Pro 的竞争对手,而不是 Pixel 8 Pro(目前)

谷歌在 Pixel 8 系列中引入了 DisplayPort 替代模式,并且在新推出的 Pixel 9 系列中也采用了该模式。虽然它主要是为了让您通过连接的屏幕镜像智能手机显示,但您也可以将其用于桌面

谷歌最近回应了有关 Pixel 9 系列 Tensor G4 性能的担忧。该公司表示,该 SoC 的设计初衷并不是为了超越基准。相反,该团队专注于使其在 Google 想要的领域表现良好。

从 Gemini 1.5 Pro 大语言模型 (LLM) 开始,Google AI 已开始为开发人员提供扩展上下文窗口和节省成本的功能。以前可通过等候名单获得完整的 200 万个代币上下文窗口

如果考虑最新更新(v15.29.34.29 beta)的 APK 拆解,谷歌的人工智能助手 Gemini 将变得更加强大。据报道,这家科技巨头的新人工智能助手可能会获得一些新的扩展。这些扩展

Pixel 9 系列即将发布,原定于 8 月 13 日发布。根据最近的传言,Pixel 9、Pixel 9 Pro 和 Pixel 9 Pro XL 将与 Pixel 8 和 Pixel 8 Pro(亚马逊售价 749 美元)一样,配备 128 GB 存储空间。

自从 Android Authority 展示谷歌隐藏在 Android 14 QPR3 Beta 2.1 中的新 Android 桌面模式以来,已经过去了几个月。紧随 Google 为 Pixel 8 和 Pixel 8 添加 DisplayPort Alt 模式支持之后

更多与 Pixel 9 系列相关的宣传材料已在网上泄露。作为参考,在 91mobiles 分享多张图片后不久,新的泄漏事件也出现了,其中还展示了 Pixel Buds Pro 2 和 Pixel Watch 3 或 Pixel Watch 3 XL。这次
