* fix: useOAuthClient support OAuth 2.0 * fix: cannot read properties of undefined (reading NEXT_PUBLIC_IS_E2E) * fix: allow OAuth 2.0 token to connect gcal or ms calendar * fix: allow OAuth 2.0 token to save gcal or ms calendar credentials * refactor: dont set oauth id header for OAuth 2.0 * fix: calendar events not showing and emails not sent * feat: CalOAuth2Provider * chore: make OAuth 2.0 work in examples app * chore: refresh OAuth 2.0 tokens * docs: running examples app with oauth 2.0 * fix: remove sensitive console.log statements that leak secrets Remove logging of: - OAuth authorization codes (oauth2-user.ts) - Token-bearing exchange responses (oauth2-user.ts) - /me response data containing PII (oauth2-user.ts) - OAuth2 refresh response with tokens (refresh.ts) - Response payload with access tokens (_app.tsx) Addresses Cubic AI review feedback for issues with confidence >= 9/10 Co-Authored-By: unknown <> * docs: update readme * fix: implemente cubic feedback * fix: seed script import * fix: seed script pkce * fix: correct typos and SQLite capitalization in OAuth2 README (#27176) Co-authored-by: cubic-dev-ai[bot] <1082092+cubic-dev-ai[bot]@users.noreply.github.com> * refactor: dont return name in public oauth endpoint * docs: CalOAuthProvider * chore: add NEXT_PUBLIC_IS_E2E constant to test * docs: fix duplicated 'or' in Cal OAuth Provider documentation (#27177) Co-authored-by: cubic-dev-ai[bot] <1082092+cubic-dev-ai[bot]@users.noreply.github.com> * revert: is e2e constant * fix: typecheck * refactor: example app users select * update readme * chore: update oauth atoms readme * refactor: enable booking managed event types with user.username instead of profile.username * fix: EventTypeSettings when viewing round robin * test: add e2e tests for atoms-oauth2 controller Co-Authored-By: lauris@cal.com <lauris.skraucis@gmail.com> * fix: correct error message path in atoms-oauth2 e2e test Co-Authored-By: lauris@cal.com <lauris.skraucis@gmail.com> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com> Co-authored-by: cubic-dev-ai[bot] <1082092+cubic-dev-ai[bot]@users.noreply.github.com> Co-authored-by: Rajiv Sahal <sahalrajiv-extc@atharvacoe.ac.in>
Atoms examples
Example apps using atoms - customizable UI components to integrate scheduling into your product.
Running examples apps locally
-
Cal's backend is required to run example apps, so clone
https://github.com/calcom/cal.comand follow setup instructions in the readme. Importantly, you need to have Google credentials setup by following this section in the docs. -
Open "apps/api/v2/.env" and copy environment variables below, and then copy
NEXTAUTH_SECRETfrom the root ".env" of repository cloned in step 1.
NODE_ENV="development"
API_PORT=5555
DATABASE_READ_URL="postgresql://postgres:@localhost:5450/calendso"
DATABASE_WRITE_URL="postgresql://postgres:@localhost:5450/calendso"
API_URL="http://localhost"
NEXTAUTH_SECRET="copy from .env of root of repository cloned in step 1"
DATABASE_URL="postgresql://postgres:@localhost:5450/calendso"
JWT_SECRET="asjdijI1JIO12I3O89198jojioSAJDU"
REDIS_URL="redis://localhost:6379"
- Start "apps/api/v2" api using
yarn dev. - Start "packages/platform/atoms" atoms package with
yarn dev. - Start "apps/web" cal web app using
yarn dx. - Open your browser at "http://localhost:3000/" and login with admin username
admin@example.comand passwordADMINadmin2022!. - In the web app navigate to
http://localhost:3000/settings/organizations/newand create a sample organization. When asked for phone verification code enter111111. - In the web app navigate to
http://localhost:3000/settings/organizations/platform/oauth-clientsand create a new oAuth client - give all permissions and set redirect uri tohttp://localhost:4321which points to example app. - Setup environment for the example app you want to run:
- First, copy ".env.example" into ".env".
- Open ".env" file and paste client id from step 8 in
NEXT_PUBLIC_X_CAL_IDand client secret inX_CAL_SECRET_KEY. If in step 2 you used the same environment variables, thenNEXT_PUBLIC_CALCOM_API_URLcan stay as is. Otherwise adjust the port to point to the sameAPI_PORTas you used in step 2.
- Navigate to example app and setup database by running
rm -f prisma/dev.db && yarn prisma db push. - Start the example app by running
yarn devand go tohttp://localhost:4321. - In the Google Cloud Console "API & Services" "Credentials"
https://console.cloud.google.com/apis/credentialsopen web project setup in step 1 and addhttp://localhost:5555/v2/gcal/oauth/saveto the authorized redirect URIs.