nktnet
BABetter Auth
•Created by shubhattin on 3/4/2025 in #help
Google Auth Not working in Production
I use
window.location.origin
as well for separate frontend and backend.
For CORs issues, it's probably related to your trustedOrigin
configuration in the auth
instance. Are you able to share this?
Docs here:
- https://www.better-auth.com/docs/concepts/cookies#cross-subdomain-cookies
The other thing to note is there may be CORs set on the backend server itself, separate from better-auth. For example, in hono
, you need to also configure:
- https://www.better-auth.com/docs/integrations/hono#cors
Finally, if you're using Safari, you may want to check on another browser first (e.g. Chrome/Firefox) to see if the issue can be reproduced.
Can't really say much else without more details into your configurations.9 replies
BABetter Auth
•Created by varo on 3/9/2025 in #help
betterauth/react acting weird and hono cors problem
@varo your issue is probably the
origin
array in your first image
For example, you have a single string:
when it should be separate strings (not stuck together in the same quote):
Also, there's no reason to specify the backend in trustedOrigin
, so really you should just use
Cors work fine for me, same setup with
- React frontend (vite, tanstack router)
- Hono backend (nodejs)
Full repo here for your reference: https://github.com/nktnet1/rt-stack6 replies
BABetter Auth
•Created by nktnet on 1/17/2025 in #help
[Solved] use google auth to access other google apis (e.g. Calendar/Drive)
Solved - you will need to query the
account
table, where your accessToken and refreshToken resides.
Example (I'm using the drizzle-orm adapter):
2 replies
BABetter Auth
•Created by nktnet on 12/31/2024 in #help
Typescript - how to infer additional, non-database fields during registration
The issue is,
registrationToken
is not a user field to be stored in the database and won't be inferred - it's a variable that the frontend submits to the backend, solely for the purpose of comparing against the backend's REGISTRATION_TOKEN variable (similar to how a matrix server would require one to register)4 replies
BABetter Auth
•Created by nktnet on 12/31/2024 in #help
Typescript - how to infer additional, non-database fields during registration
After some investigation, I discovered that the following hack/workaround can be used to remove the type error:
Note: if we instead follow the docs and use
to try to sync with the server auth types, the hack for
registrationToken
will no longer work (it gets ignored). Is there a better way?
Is there a better way?4 replies