Closed colburncodes closed 3 months ago
The latest update integrates GitHub authentication into the project. Key changes include adding the passport-github2
dependency, updating components to replace Twitter with GitHub authentication, enhancing environment configurations to include GitHub auth credentials, and incorporating database schema updates to store GitHub profile IDs. The authentication backend logic now supports GitHub, and console logs in the user-related mutations have been cleaned up.
File(s) | Change Summary |
---|---|
package.json |
Added "passport-github2": "^0.1.12" dependency. |
src/core/components/auth-form.tsx |
Updated imports to include GitHubButton and replaced TwitterButton with GithubButton in the UI. |
src/core/components/social-buttons/social-buttons.tsx |
Modified GithubButton to extend ComponentPropsWithoutRef<"a"> and use an anchor element. |
src/env.mjs |
Added NEXT_PUBLIC_GITHUB_AUTH_CLIENT_ID and NEXT_PUBLIC_GITHUB_AUTH_SECRET_KEY to environment configurations. |
src/features/auth/mutations/requestEmailVerification.ts |
Removed a redundant console.log(user) line. |
src/features/auth/mutations/signup.ts |
Removed the return user statement after session creation. |
src/pages/api/auth/[...auth].page.ts |
Introduced GitHub authentication logic using Blitz.js and passport-github2 . |
db/migrations/.../migration.sql |
Added githubProfileId column to the User table. |
db/schema.prisma |
Added githubProfileId field to the User model. |
sequenceDiagram
participant User
participant AuthForm
participant GithubButton
participant API
participant PassportGitHubStrategy
participant DB
User->>AuthForm: Open Auth Form
AuthForm->>GithubButton: Display Github Button
User->>GithubButton: Click Github Button
GithubButton->>API: Redirect to /api/auth/github
API->>PassportGitHubStrategy: Initiate OAuth Flow
PassportGitHubStrategy->>GitHub: Request Authorization
GitHub->>PassportGitHubStrategy: Send User Info
PassportGitHubStrategy->>DB: Find/Create User
DB->>PassportGitHubStrategy: User Data Response
PassportGitHubStrategy->>API: Success Response
API->>User: Redirect to App
In a land of code, a change so grand,
GitHub joins our authentication band.
Twitter steps aside, new buttons arise,
Anchors in forms beneath the skies.
The database now holds new keys,
With profiles that GitHub sees.
Code evolves, more secure and bright,
A rabbit's joy in the digital light!
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Summary by CodeRabbit