#Better auth

4 messages · Page 1 of 1 (latest)

sterile iris
#

What’s the current state of better auth integration with convex?

Will I be able to integrate it with expo and react native for mobile dev?

wispy abyssBOT
#

Hi @sterile iris. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

Convex offers two main approaches for authentication in your applications, including React Native and Expo projects:

Convex Auth

Convex Auth is a beta feature that allows you to implement authentication directly within your Convex backend without needing an external authentication service. It supports:

  • Magic Links & OTPs (email)
  • OAuth (sign in with Github/Google/Apple)
  • Password-based authentication

For React Native/Expo specifically, Convex Auth is compatible and working, though there are some considerations:

  • Some developers have successfully implemented native Apple and Google Sign In with Convex Auth in Expo, as shown in community discussions on Discord
  • There are examples of implementing OTP authentication with Convex Auth in React Native

However, you might encounter challenges with OAuth redirects in the development environment due to the nature of Expo's URLs.

Third-party Authentication

Alternatively, Convex works well with third-party authentication providers:

  • Clerk is recommended for better React Native support
  • Auth0 offers more established features
  • Custom Auth Integration with any OpenID Connect-compatible provider

Many community members have successfully integrated Clerk with Convex in React Native/Expo projects, as documented in this Stack guide.

Considerations for React Native/Expo

When implementing authentication in a React Native/Expo project with Convex:

#
  1. For monorepo setups (web + mobile), you might need special configuration to handle different redirect URIs and client IDs
  2. Some users have reported issues with session persistence when the app is in the background for extended periods
  3. Native authentication experiences (using expo-apple-authentication and similar libraries) can be implemented with Convex Auth but require custom code

If you're starting a new project, the Convex team has created a turborepo template that demonstrates how to set up Convex with Next.js and Expo using Clerk for authentication.

Overall, both Convex Auth and third-party integrations are viable options for React Native/Expo projects, with the choice depending on your specific requirements and preferences.

GitHub: 1

Discord: 7

Stack: 1

Labs: 3

Docs: 2

GitHub: 1

Discord: 7

Stack: 1

Labs: 3

Docs: 2

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: