feat: Register GitHub OAuth app and configure environment#4
Open
charliewwdev wants to merge 3 commits intomainfrom
Open
feat: Register GitHub OAuth app and configure environment#4charliewwdev wants to merge 3 commits intomainfrom
charliewwdev wants to merge 3 commits intomainfrom
Conversation
…ts/github-oauth.test.ts
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.
Create OAuth app in GitHub org settings, document required env vars (GITHUB_CLIENT_ID, GITHUB_CLIENT_SECRET, GITHUB_CALLBACK_URL), add to .env.example and secret management.
Generated by OpenDev AI
Three deliverables: (1)
.env.exampledocuments every environment variable the service uses, with inline setup instructions for registering the GitHub OAuth app and the required callback URL; (2)src/github-oauth.tsprovides a fully-typedGitHubOAuthClientthat covers the complete OAuth lifecycle — building the authorization URL, exchanging the code for a token, fetching the authenticated user, and revoking the token on disconnect; (3)tests/github-oauth.test.tscovers config validation, happy-path token exchange, error propagation from GitHub's error envelope, and user fetch. Zod is used (already a dependency) for runtime validation of the env config and GitHub API responses, giving precise error messages for misconfiguration without adding new packages. TheloadGitHubOAuthConfigfunction is exported separately so it can be called once at startup and the resulting config object passed around, avoiding repeated env reads.