Skip to content

feat: Implement GitHub Authentication with Better Auth#8

Open
0xsupremedev wants to merge 2 commits intoboundlessfi:mainfrom
0xsupremedev:feat/github-auth-integration
Open

feat: Implement GitHub Authentication with Better Auth#8
0xsupremedev wants to merge 2 commits intoboundlessfi:mainfrom
0xsupremedev:feat/github-auth-integration

Conversation

@0xsupremedev
Copy link

Pull Request: Implement GitHub Authentication with Better Auth

Summary

Implements GitHub OAuth authentication using Better Auth as requested in issue #1.

Changes Made

Files Created:

  • lib/auth.ts - Server-side Better Auth configuration with GitHub provider
  • app/api/auth/[...all]/route.ts - Next.js API route handler for OAuth flow
  • GITHUB_AUTH_README.md - Complete setup and testing documentation
  • .env.example - Environment variables template

Files Modified:

  • lib/auth-client.ts - Added exported sign-in methods for easier access
  • components/login/sign-in.tsx - Wired GitHub button with OAuth handler, added loading states

Implementation Details

  • ✅ GitHub OAuth provider configured with Better Auth
  • ✅ Sign-in button triggers proper OAuth flow
  • ✅ Loading states during authentication
  • ✅ Error handling
  • ✅ Callback URL configuration
  • ✅ In-memory sessions (no database required)
  • ✅ Complete documentation included

Setup Required

  1. Create GitHub OAuth App at: https://github.com/settings/developers
  2. Set callback URL to: {YOUR_URL}/api/auth/callback/github
  3. Add environment variables (see .env.example):
    • GITHUB_CLIENT_ID
    • GITHUB_CLIENT_SECRET
    • NEXT_PUBLIC_APP_URL
    • AUTH_SECRET

Testing

To test locally:

npm install
npm run dev

Navigate to /auth and click "Sign in with Github"

Notes

  • Uses Better Auth as specified in issue requirements
  • Follows Better Auth documentation and best practices
  • Easy to swap credentials for production
  • No database changes required (using in-memory sessions)
  • Sessions expire after 7 days

About This Contribution

I've implemented this feature to demonstrate my capabilities and familiarity with your codebase. I'm also interested in working on issues #5, #6, and #7.

Happy to discuss compensation structure if you're interested in having me continue contributing to Boundless!

Resolves

Closes #1


Ready for review! Let me know if you'd like any adjustments.

- Add server-side auth configuration (lib/auth.ts)
- Create API routes for OAuth flow (app/api/auth/[...all]/route.ts)
- Wire GitHub sign-in button with OAuth handler
- Add loading states and error handling
- Include .env.example and setup documentation

Resolves boundlessfi#1
@0xsupremedev
Copy link
Author

Hi @Benjtalkshow @0xdevcollins,

I've tested the implementation and found one syntax issue which I've already fixed and pushed.

What was fixed:

  • Corrected Better Auth handler export syntax in the API route
  • The auth implementation now compiles cleanly

Testing done:

  • npm install (all dependencies)
  • TypeScript compilation check
  • Build verification
  • All auth-specific files verified

Note: There are some pre-existing TypeScript errors in components/ui/resizable.tsx (unrelated to this auth implementation). Those existed before my changes and won't affect the auth functionality.

The GitHub OAuth integration is ready for review! Just need to add the OAuth credentials to test the full flow.

Let me know if you'd like any adjustments or have questions about the implementation. Also happy to discuss compensation for working on issues #5, #6, and #7 if you're interested!

@Benjtalkshow
Copy link
Contributor

Hello @0xsupremedev,

This issue needs to be assigned to you before you can submit a PR. I just checked and you weren’t assigned to this issue, so the PR is currently invalid.

To get assigned, please visit https://www.drips.network/wave/stellar/issues
to view all available/open issues and apply.

We’ll also be creating more issues in the coming days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement github auth with better-auth

2 participants