Better AuthBA
Better Authβ€’7mo agoβ€’
2 replies
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 πŸ™‚
Was this page helpful?