Show HN: Oauth2_capture – A Django package for handling OAuth2 token flows

I've created oauth2_capture (https://github.com/heysamtexas/django-oauth2-capture/), a Django package that makes it easy to capture, store, and refresh OAuth2 tokens from multiple providers.

The package currently supports Twitter/X, LinkedIn, GitHub, Reddit, Pinterest, and Facebook, with more providers planned. It handles the entire OAuth2 flow, from authorization to token storage and automatic refreshing.

Key technical features:

  * PKCE support for providers that require it
  * Token refresh with retry logic for rate limiting (429 responses)
  * Clean Django models and admin integration
  * Proper token expiration handling
I built this because I kept reimplementing OAuth2 flows in different projects and wanted a reusable solution. The package is designed to be easily extended to support additional providers.

I'd love feedback from the community on the API design, code quality, or additional features that would be useful.

Yes, Allauth does a great job of oauth and user signups/management. This is not that.

When to use oauth2_capture

Choose oauth2_capture when your application needs to:

  * Post to social media platforms on behalf of users
  * Access provider APIs (GitHub, LinkedIn, etc.) using user permissions
  * Perform actions that require fresh OAuth tokens with specific scopes
  * Maintain long-term API access with automatic token refreshing
  * When to use django-allauth
Choose django-allauth when you primarily need:

  * Social authentication for user login
  * User registration and management
  * Email verification workflows
  * Account linking between social providers
Can they be used together?

Absolutely! You can use django-allauth for user authentication and oauth2_capture for API interactions. They solve different problems and complement each other well.

Simply put: django-allauth manages users, oauth2_capture manages tokens.

3 points | by simplecto 19 hours ago

0 comments