xephyr
BABetter Auth
•Created by shu-sin on 4/6/2025 in #bug-reports
Generic oauth failing on missing email
Thanks for the clarification.
From my perspective it isn't necessarily a need for email to be optional (though perhaps it is a need for other people).
For me it is that I'd like
authClient.signIn.oauth2()
/auth.api.oauth2
to return a "partially complete" status with some identifier/token if:
1. The OAuth login was successful
2. The OAuth response did not include email
This way we could handle requiring an email from the user, and then we could call something like authClient.signIn.resumeOauth2({ resumeToken, email });
to fully complete the auth.
The fact it's required means we have to set a fake email as their email, then add a bunch of client code to block users from doing anything on the site until they give us their email (which people will try to avoid), etc.20 replies
BABetter Auth
•Created by shu-sin on 4/6/2025 in #bug-reports
Generic oauth failing on missing email
A genericOAuth2 provider not returning
email
, it doesn't look like its possible with the base library anyway but I thought I'd ask since if better-auth-ui found a way to handle it we could look at that20 replies
BABetter Auth
•Created by shu-sin on 4/6/2025 in #bug-reports
Generic oauth failing on missing email
would prefer it to be baked in to better-auth but for now it should do the job
20 replies
BABetter Auth
•Created by shu-sin on 4/6/2025 in #bug-reports
Generic oauth failing on missing email
yeah my temporary solution is probably going to be
email: fakeemail+{accountId}@whatever.com
emailVerified: false
and redirect to some UI to accept an email, and show a non-dismissible dialog asking for email on any other page if they try and circumvent it20 replies
BABetter Auth
•Created by shu-sin on 4/6/2025 in #bug-reports
Generic oauth failing on missing email
@daveycodez Sorry for the unexpected ping, but looking through the code for
better-auth-ui
I don't see anything that would handle this state on your side. Is that correct?20 replies
BABetter Auth
•Created by shu-sin on 4/6/2025 in #bug-reports
Generic oauth failing on missing email
If we insist on
email
being required, this UX would be acceptable to me. However since better-auth is headless, some API by which we can intercept the failure state => display a form of our choosing to the user => and subsequently resume the OAuth user creation flow would be ideal.20 replies
BABetter Auth
•Created by shu-sin on 4/6/2025 in #bug-reports
Generic oauth failing on missing email

20 replies
BABetter Auth
•Created by shu-sin on 4/6/2025 in #bug-reports
Generic oauth failing on missing email
Bumping this, email being required is a frustrating limitation.
20 replies
BABetter Auth
•Created by Henrik on 4/15/2025 in #help
Next.js server actions auth
@KiNFiSH I've refactored it to use
authClient
now, but I'm still curious why the server action wasn't working so I've recreated it. Let me know what you think 🙂
21 replies
BABetter Auth
•Created by Henrik on 4/15/2025 in #help
Next.js server actions auth
(I've switched to using authClient instead, ditched
useActionState
with server actions)21 replies
BABetter Auth
•Created by Henrik on 4/15/2025 in #help
Next.js server actions auth
at least not for me
21 replies
BABetter Auth
•Created by Henrik on 4/15/2025 in #help
Next.js server actions auth
the session doesn't update though
21 replies
BABetter Auth
•Created by Henrik on 4/15/2025 in #help
Next.js server actions auth
i'm not sure where the cookies are supposed to be set
21 replies
BABetter Auth
•Created by Henrik on 4/15/2025 in #help
Next.js server actions auth
so the server action either returns a conform error response or redirects
21 replies
BABetter Auth
•Created by Henrik on 4/15/2025 in #help
Next.js server actions auth
I think I'm misunderstanding something about how it's meant to set cookies, because I'm not using
asResponse
and returning it because it's in useActionState
so it can't return Response
21 replies
BABetter Auth
•Created by Henrik on 4/15/2025 in #help
Next.js server actions auth
I did and it didn't help https://discord.com/channels/1288403910284935179/1361660287954194442/1361660287954194442
21 replies
BABetter Auth
•Created by xephyr on 4/15/2025 in #help
Anyone using auth.api in a server action with useActionState?
FWIW here's the action:
3 replies