BA
Better Auth•2mo ago
Sacha

Better Auth + Expo GO

Hey everyone, I'm quite new to Better Oath and ExpoGo, so it might sound like a newbie question. After a lot of investigation with Cursor, Gemini, and looking on the web, I couldn't find my answer, so I'm asking for help here. I'm stumbling upon a problem where I want to set up Discord authentication using BetterAuth in my app and I want to test it with Expo Go. I'm currently working on a mono repo, so my backend is defined in Next.js and I have a web app to compare and test with. BetterAuth works pretty well with it, whether it's locally or on Vercel, but I cannot manage to make it work on the app. The problem is as follows: Whenever I try to sign in with Discord on the Expo Go build of my app, the Discord authentication window opens, I put my credentials, and they are validated. But when I'm redirected to the app, the session is not updated, and not considered as logged in. Looking at the documentation, this seems to have a link with the trustedOrigins and callback URLs defined in the configuration. But I cannot wrap my head around it because after a lot of tries and a lot of discussions with AI tools, I cannot find a solution to it. Since expo.go also seems to have its own scheme and not use the one you define in the app.json, this could be one of the sources of the error as well. Anyway, any help is welcome 🙂
1 Reply
Sacha
SachaOP•2mo ago
Here is Perplexity's answer after asking about it: Based on the official Expo and Better Auth documentation, Expo Go cannot be used for local development and testing of OAuth or OpenID Connect-enabled apps, including setups that require deep linking or custom URL schemes for authentication flows. This is because Expo Go does not allow you to customize your app scheme, which is essential for handling OAuth redirects back into your app after authentication. The Better Auth documentation describes the standard setup for Expo apps, including installing the necessary packages, configuring deep links, and initializing the client. However, these instructions assume you can define a custom scheme in your app configuration—something not possible with Expo Go. I assume it's right so I'll leave it for now, let me know if you have anything to say about it

Did you find this page helpful?