[GH-ISSUE #301] Demo / Docs on backend Python support #8210

Closed
opened 2026-04-13 03:18:45 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @supnim on GitHub (Oct 23, 2024).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/301

Is your feature request related to a problem? Please describe.
I am currently transitioning my authentication system from Supabase to Better-Auth and am integrating it with a Django backend. I find it difficult to get started as there is limited documentation on how to set up Better-Auth with Python/Django, especially in terms of authentication logic and handling JWTs or bearer tokens.
(I a new dev so forgive me)

Describe the solution you'd like
It would be helpful to have documentation or a demo repository that clearly explains the setup process for a Python backend, specifically using Django or any other common Python frameworks. The documentation should cover the following:

  • Installing Better-Auth for a Django backend
  • Handling authentication tokens (JWT or bearer tokens)
  • Integrating with Google sign-in and other social providers
  • Example middleware for token validation
  • Best practices for security and token storage (e.g., in cookies)

Describe alternatives you've considered
Currently, I am reviewing examples for Node.js setups and trying to adapt them for Python, but a dedicated guide for Python would greatly speed up the integration process.

Additional context
I am using Django-Ninja for my API endpoints and PostgreSQL as my database. Any Python-based examples would be beneficial for developers working with similar stacks.

Originally created by @supnim on GitHub (Oct 23, 2024). Original GitHub issue: https://github.com/better-auth/better-auth/issues/301 **Is your feature request related to a problem? Please describe.** I am currently transitioning my authentication system from Supabase to Better-Auth and am integrating it with a Django backend. I find it difficult to get started as there is limited documentation on how to set up Better-Auth with Python/Django, especially in terms of authentication logic and handling JWTs or bearer tokens. (I a new dev so forgive me) **Describe the solution you'd like** It would be helpful to have documentation or a demo repository that clearly explains the setup process for a Python backend, specifically using Django or any other common Python frameworks. The documentation should cover the following: - Installing Better-Auth for a Django backend - Handling authentication tokens (JWT or bearer tokens) - Integrating with Google sign-in and other social providers - Example middleware for token validation - Best practices for security and token storage (e.g., in cookies) **Describe alternatives you've considered** Currently, I am reviewing examples for Node.js setups and trying to adapt them for Python, but a dedicated guide for Python would greatly speed up the integration process. **Additional context** I am using Django-Ninja for my API endpoints and PostgreSQL as my database. Any Python-based examples would be beneficial for developers working with similar stacks.
GiteaMirror added the locked label 2026-04-13 03:18:45 -05:00
Author
Owner

@Bekacru commented on GitHub (Oct 23, 2024):

Better Auth is a TypeScript-only library. If you're planning to use it in a TypeScript backend and connect a Python client to a separate auth server, you can use REST API with the JWT plugin. Currently, we don’t provide—and don’t plan to provide—clients for Python or other languages in the near future. But, we will have OpenAPI documentation in the future, which you can reference to build your own client or make queries using the REST API.

<!-- gh-comment-id:2430980353 --> @Bekacru commented on GitHub (Oct 23, 2024): Better Auth is a TypeScript-only library. If you're planning to use it in a TypeScript backend and connect a Python client to a separate auth server, you can use REST API with the JWT plugin. Currently, we don’t provide—and don’t plan to provide—clients for Python or other languages in the near future. But, we will have OpenAPI documentation in the future, which you can reference to build your own client or make queries using the REST API.
Author
Owner

@raisiqueira commented on GitHub (Dec 4, 2024):

@Bekacru I have a similar problem to solve, and I think that Better Auth can help me with the authentication on my client application (a Next.js app).

The question is: Can I use Better Auth with my Python backend (a FastAPI backend)? This backend uses JWT token authentication. If yes, how can I set up Better Auth to support this backend API?

<!-- gh-comment-id:2517665417 --> @raisiqueira commented on GitHub (Dec 4, 2024): @Bekacru I have a similar problem to solve, and I think that Better Auth can help me with the authentication on my client application (a Next.js app). The question is: Can I use Better Auth with my Python backend (a FastAPI backend)? This backend uses JWT token authentication. If yes, how can I set up Better Auth to support this backend API?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#8210