Expo Android + Better Auth: 403 MISSING_OR_NULL_ORIGIN on sign-up/sign-in
I’m using Better Auth + Drizzle (Postgres) with Expo (Android emulator) for email/password auth against my local server.
Setup:
* Server:
.env →
* Client:
Error:
{"code":"MISSING_OR_NULL_ORIGIN","message":"Missing or null Origin","status":403}
What I’ve tried:
* Added client:// to both trustedOrigins and CORS_ORIGINS.
* Using expoClient (should inject custom origin).
* Android uses 10.0.2.2.
Question:
What’s the correct way to configure CORS/origin for Better Auth + React Native (Expo)?
Should client:// be in the CORS allow list, or should I bypass CORS in dev?
Anything else needed for the server to accept the Expo client’s custom origin?5 Replies
Allright i have changed the schema to myapp. It seems that the origin is undefined for some reason:
Headers: {
method: 'POST',
path: '/api/auth/sign-in/email',
origin: undefined,
expoOrigin: 'myapp://'
Running into the same issue in the last couple of days. I know this used to work before.
Same issue here too, past 5-6 it doesn't work
Were u able to fix this?
Yup
Check out my post about this: https://discord.com/channels/1288403910284935179/1434148072409268274
Basically add:
Before the better auth configuration/registration