wx
BABetter Auth
•Created by wx on 2/18/2025 in #help
Weird behaviour when logging in with Discord
Hey, I am using Better Auth with latest Next.js and I have this weird "bug (?)" when logging in with Discord. Discord is my only option to log in with.
When I click the login button, which I have tried two approaches:
1. Client component with a button that has an async
onClick()
event which awaits the signIn()
function from auth-client.ts
.
2. Same as the first one, but with a server action instead.
The button looks like this:
The signIn()
function looks like this:
When I start my local server and click the login button, I get an error, however without any message. This is the output in the dev tools console after I click it:
What's weird is that the button starts to work after I modify either the onSuccess()
or onError()
function, just another console.log()
is enough. Then it starts to work again.
I have built the authentication using the documentation and all of the code for auth comes from there too.
Does anyone know what the issue could be?4 replies