Commit fb591e1
committed
feat(vercel): implement robust OAuth callback handling
Add typed structures, schema validation, and token exchange helper
for the Vercel OAuth callback flow. Introduce TokenResponse,
ProjectWithOrganization, StateData, and CallbackParams types to make
intent explicit and reduce implicit any usage.
Add VercelCallbackSchema (zod) to validate incoming callback query
parameters and ensure safer parsing of code/state/error payloads.
Implement exchangeCodeForToken helper that posts to Vercel's token
endpoint, handles errors, logs failures, and returns a normalized token
shape (including raw response). This centralizes HTTP logic and
improves error handling.
Refactor createOrFindVercelIntegration to use the new TokenResponse and
ProjectWithOrganization types, simplify flow comments, and avoid
repetitive code by updating/creating integrations with consistent data.
Overall this change improves type safety, error reporting, and
readability of the Vercel OAuth callback route.1 parent 2f926d7 commit fb591e1
1 file changed
+398
-344
lines changed
0 commit comments