Calendar
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 35/100
- Issue 类型
- 文档
- 描述清晰度
- 需要澄清
- 活跃度
- 冷清
- 技术栈
- nextjs, typescript
调研方向
未指定仓库文件、测试或文档入口。首先确定 Google Calendar 和 Clerk 的身份验证指南应放在 QCX 的什么位置,然后核实 OAuth 作用域、令牌获取示例和 Calendar API 请求是否合适;当这些信息被放置在约定的文档位置时,即视为完成。
由索引模型根据 Issue 内容生成。
描述
Answer
To use Google Calendar with Clerk authentication, you need to enable Google OAuth and request the appropriate calendar scopes. (1)
Required Scopes
When configuring Google as a social connection, include these scopes to access calendar data:
- `https://www.googleapis.com/auth/calendar.readonly%60
- `https://www.googleapis.com/auth/calendar.events.readonly%60
Accessing Calendar Data
Once a user signs in with Google, Clerk stores and manages their OAuth tokens automatically. Use getUserOauthAccessToken to retrieve the access token for making Google Calendar API requests:
'use server'
import { auth, clerkClient } from '@clerk/nextjs/server'
export async function getGoogleToken() {
const { userId } = await auth()
const client = await clerkClient()
const token = await client.users.getUserOauthAccessToken(userId || '', 'oauth_google')
return {
token: token.data[0].token,
}
}
Making Calendar Requests
Use the retrieved token to call the Google Calendar API:
const client = await clerkClient()
const token = await client.users.getUserOauthAccessToken(userId, 'oauth_google')
const accessToken = token.data[0].token
// Code removed for brevity.
const response = await fetch(
`<https://www.googleapis.com/calendar/v3/calendars/$%7BencodeURIComponent(>
calendarId,
) }/events?timeMin=${monthStart.toISOString() }&timeMax=${monthEnd.toISOString() }&singleEvents=true&orderBy=startTime`,
{
headers: {
Authorization: `Bearer ${accessToken}`,
},
},
)
Clerk automatically keeps access tokens current, so you don't need to handle token refresh manually. For a complete working example, check out the BookMate demo application or its source code on GitHub .
- 主要语言
- TypeScript
- 星标
- 19
- 派生
- 7
- 平均合并
- 24 分钟
- 30 天内合并 PR
- 9
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
QueueLab/QCX 的其他 Issue
-
Settings未关闭
难度 2/5 1-3 小时 新手友好度 64/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
维护者通常 1 天内回复
-
Collaboration未关闭
难度 5/5 一周以上 新手友好度 30/100
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 35/100
维护者通常 1 天内回复
相似的 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 72/100
AOSSIE-Org/DebateAI#611 ·
维护者通常 3 天内回复
-
难度 2/5 1-3 小时 新手友好度 65/100
openzim/mwoffliner#2933 ·
维护者通常 1 天内回复
-
Use the README category name for website links and submissions可能已有人在做 @dajiaohuang 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
birobirobiro/awesome-shadcn-ui#647 ·
维护者通常 2 天内回复
-
Twake Drive picker: closePicker() never destroys the intent (stop() is on the promise returned by start(), not by create())可能已有人在做 @chibenwa 今天认领。 未关闭claude
难度 2/5 1-3 小时 新手友好度 84/100
linagora/twake-calendar-frontend#1498 · 1 条评论 ·
维护者通常 1 天内回复
-
check:passed streams:add
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复