Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Calendar

未关闭
#736 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 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:

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 模板
  • 没有贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

QueueLab/QCX 的其他 Issue

查看 QueueLab/QCX 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。