N
Nuxt3mo ago
WiFi Plug

moving from supabase auth > better-auth or nuxt auth utils?

I'm using supabase auth currently but thinking longer term is nuxt auth utils a better approach if im also using nitro websockets as it has an integration with that etc or are people using better-auth? could you explain the process and pros / cons
6 Replies
kapa.ai
kapa.ai3mo ago
Hi @WiFi Plug. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Based on the available knowledge sources, here’s what can be said about moving from Supabase Auth to Nuxt Auth Utils, and the context around “better-auth”: Nuxt Auth Utils Nuxt Auth Utils is an official Nuxt module designed for session and authentication management in Nuxt apps. It provides utilities for both client-side and server-side session handling, using sealed cookies for session storage (no database required by default, but you can add one). It also supports integration with Nitro, including features like WebSockets, and offers out-of-the-box support for 20+ OAuth providers, password hashing, and WebAuthn/Passkeys. The module is actively developed and is part of the Nuxt roadmap for future releases, with a focus on seamless integration with the Nuxt ecosystem and Nitro server engine. Pros: - Tight integration with Nuxt and Nitro (including WebSockets). - Simple session management using encrypted cookies. - Supports many OAuth providers and advanced auth features. - No database required for basic session storage (but can be added). - Officially maintained and documented by the Nuxt team. - Example recipes and guides are available for setup and extension [Sessions and Authentication Recipe]. Cons: - If you rely on Supabase’s real-time features, database, or storage, you’ll need to replace or reimplement those parts. - Migration effort if you have existing Supabase-specific logic. Supabase Auth Supabase Auth is a managed authentication solution with built-in support for OAuth, email/password, and other providers, tightly coupled with Supabase’s database and real-time features. It’s a good fit if you’re already using Supabase for your backend and want a managed, scalable auth solution. Pros: - Managed, scalable, and easy to set up. - Deep integration with Supabase’s database, storage, and real-time features. - Handles OAuth, email/password, and more out of the box. Cons: - Less flexibility if you want to move away from Supabase’s backend. - Integration with Nitro WebSockets or custom session logic may require more work. “better-auth” There is no mention of a “better-auth” module or package in the official Nuxt documentation or roadmap, nor in the provided knowledge sources. It’s possible this refers to a third-party or community solution, but there’s no information available to compare it directly. Recommendation & Migration Process If you are planning to use Nitro WebSockets and want a solution that is tightly integrated with Nuxt and Nitro, Nuxt Auth Utils is likely the better long-term choice. It’s designed for full-stack Nuxt apps, supports advanced authentication scenarios, and is actively maintained by the Nuxt team [Sessions and Authentication Recipe]. Migration process (high-level): 1. Install and configure nuxt-auth-utils in your Nuxt project. 2. Set up session management and authentication routes using the provided utilities. 3. Replace Supabase Auth logic with Nuxt Auth Utils composables and helpers. 4. If you need database-backed users, integrate with a database using Nitro’s database support. 5. For OAuth, configure the desired providers as per the module’s documentation. Summary:
Nuxt Auth Utils is the recommended approach for Nuxt/Nitro projects, especially if you want deep integration with Nitro features like WebSockets. Supabase Auth is still a solid choice if you’re committed to the Supabase ecosystem. There’s no information about “better-auth” in the official sources, so it cannot be recommended or compared here. If you need more details on the migration steps or specific code examples, the official Nuxt sessions and authentication recipe is a great starting point. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai3mo ago
<@679734274840330384> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
WiFi Plug
WiFi PlugOP3mo ago
@kapa.ai so supabase uses bcrypt for hashing passwords, but i believe nuxt auth utils uses scrypt so how would that work to move existing users over? would they all be forced to reset their passwords or somehow i would need to support both bcrypt and scrypt?
kapa.ai
kapa.ai3mo ago
Let me check the knowledge base for you again. One moment! :books: ---------------------- I'm sorry, but the knowledge sources do not explicitly mention the password hashing algorithm used by Nuxt Auth Utils (such as scrypt) or provide guidance on migrating users from Supabase (which uses bcrypt) to Nuxt Auth Utils. There is also no information on supporting both bcrypt and scrypt simultaneously or on handling password migration scenarios (such as requiring users to reset their passwords). If you are considering such a migration, you may need to consult the documentation for both Supabase and Nuxt Auth Utils directly, or look for community discussions on this specific migration path. Based on the available sources, I cannot provide a definitive answer to your question. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai3mo ago
<@679734274840330384> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
LeFt_HitD
LeFt_HitD3mo ago
you can using any auth solutions with nuxt-auth-utils, after logged user in via external solutions, such as supabase auth (on Nitro API), then assign current session to the user im using nuxt-auth-utils with supabase SSR to login user, and store user info in auth utils, while for every request, would check user's session and throw error if session is invalid

Did you find this page helpful?