OAuth credential sync and app integration enhancements - #4
Open
akshayutture-augment wants to merge 1 commit into
Open
OAuth credential sync and app integration enhancements#4akshayutture-augment wants to merge 1 commit into
akshayutture-augment wants to merge 1 commit into
Conversation
…11059) * Add credential sync .env variables * Add webhook to send app credentials * Upsert credentials when webhook called * Refresh oauth token from a specific endpoint * Pass appSlug * Add credential encryption * Move oauth helps into a folder * Create parse token response wrapper * Add OAuth helpers to apps * Clean up * Refactor `appDirName` to `appSlug` * Address feedback * Change to safe parse * Remove console.log --------- Co-authored-by: Syed Ali Shahbaz <52925846+alishaz-polymath@users.noreply.github.com> Co-authored-by: Omar López <zomars@me.com>
There was a problem hiding this comment.
This PR is being reviewed by Cursor Bugbot
Details
You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.
To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.
| googleCredentials.access_token = token.access_token; | ||
| googleCredentials.expiry_date = token.expiry_date; | ||
| const key = googleCredentialSchema.parse(googleCredentials); | ||
| const key = parseRefreshTokenResponse(googleCredentials, googleCredentialSchema); |
There was a problem hiding this comment.
Bug: Storing the Wrapper, Not the Data
parseRefreshTokenResponse returns a SafeParseReturnType object with success and data properties, but the code treats it as the actual token data. The Prisma update stores the entire { success, data } object instead of just the validated token data. Should use key.data when updating the credential.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Test 8
Replicated from ai-code-review-evaluation/cal.com-cursor#8
Note
Introduces an app-credential sync webhook and shared OAuth refresh utilities, updating many integrations to use them and adding required env/config flags.
apps/web/pages/api/webhook/app-credential.tsto sync app credentials via verified webhook (decrypts keys, creates/updatesprisma.credential).parseRefreshTokenResponseandrefreshOAuthTokensunderpackages/app-store/_utils/oauth/.encodeOAuthState/decodeOAuthStateandcreateOAuthAppCredentialinto.../_utils/oauth/and update imports.redirect_uriin add flow..env.example: add App Credential Sync settings (CALCOM_WEBHOOK_SECRET,CALCOM_WEBHOOK_HEADER_NAME,CALCOM_CREDENTIAL_SYNC_ENDPOINT,CALCOM_APP_CREDENTIAL_ENCRYPTION_KEY).packages/lib/constants.ts: addAPP_CREDENTIAL_SHARING_ENABLEDflag.turbo.json: expose new env vars inglobalEnv.Written by Cursor Bugbot for commit 824145b. Configure here.