Skip to content

Conversation

@tsahil01
Copy link

@tsahil01 tsahil01 commented Sep 25, 2025

What this PR does:

  • Adds "Continue with X" button to sign-in page (/session/new)
  • Adds connect/disconnect X account to profile page (/users/me/profile)
  • Implements OAuth 2.0 authentication flow

Key changes:

  • OAuth setup: Added omniauth-twitter2 gem and configuration
  • Database: Added provider and uid fields to users table with proper indexes
  • UI: Added OAuth buttons to sign-in and profile pages
  • Logic: OAuth callback handling, account linking, and error handling
  • Environment: Updated .env.sample with required Twitter API credentials
Screenshot 2025-09-26 at 12 17 11 AM

Tests added:

  • Model tests (test/models/user_oauth_test.rb): 18 tests covering OAuth connection, disconnection, validation, and edge cases
  • Controller tests (test/controllers/sessions_oauth_test.rb): 9 tests for OAuth callback flows, error handling, and authentication scenarios
  • System tests (test/system/oauth_integration_test.rb): End-to-end tests for complete OAuth user flows

How to test:

  1. Set up Twitter app with OAuth 2.0 enabled
  2. Add environment variables:
    TWITTER_CLIENT_ID=your_client_id
    TWITTER_CLIENT_SECRET=your_client_secret
  3. Set callback URL in Twitter app: https://smallbets.com/auth/twitter2/callback
  4. Test sign-in page and profile page OAuth flows

AI disclosure:

  • Used claude-4-sonnet

Resolves: #20

@tsahil01
Copy link
Author

tsahil01 commented Oct 2, 2025

@dvassallo can you review this one?

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.

1 participant