Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Calendar

Aperta
#736 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
35/100
Tipo di issue
Documentazione
Chiarezza
Da chiarire
Stato di attività
Tranquilla
Stack tecnologico
nextjs, typescript

Direzione di ricerca

Non viene indicato alcun file del repository, test o punto di ingresso della documentazione. Identifica innanzitutto dove deve essere inserita in QCX la guida all’autenticazione di Google Calendar e Clerk, quindi verifica che gli scope OAuth, l’esempio di recupero del token e la richiesta a Calendar API siano appropriati; il lavoro è considerato completato quando le informazioni sono collocate nella posizione concordata per la documentazione.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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 .

Lingua principale
TypeScript
Stelle
19
Fork
7
Merge medio
59m
PR unite (30g)
16

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di QueueLab/QCX

Tutte le issue di QueueLab/QCX

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.