Discord OAuth Issue
I'm recreating this post but with much less rambling than our old post to make it more digestible. (https://discord.com/channels/1288403910284935179/1383602900923842660)
We have a huge bug with BA. Every time a user OAuths (a) using ONLY Discord and (b) ONLY on prod, a brand new account/user is generated. This does NOT happen locally, or with email/pass/other oauth providers.
X
Any help please?
22 Replies
@Ping Any insight?
@Stephen Is it both a new account & a new user?
Just checked - it is indeed a brand new account and user per sign in
Am I able to see screenshots of your DB? Would like to see both users on the user table created via discord oauth.
And also
account
table of the two users too, thanks.Yes sir, just logged in twice to generate two new accounts. Here they are:


Just want to make sure, both emails are the same right?
Yes sir, identical, blocked out for obvious reasons :)
This is why it's so strange. Logging in with the exact same Discord account!
Not just mine too by the way, applies to all Discord accounts
I wonder if it has something to do with your prod.
Lots of people use Discord oauth but I've never seen such an issue.
Are you using a VPS or some cloud provider?
We also find it very strange how this is only happening in prod. Locally, I log into my existing account just fine!
Paging in @Dawson, any insight here?
At a high level we're using Dokploy on a VPS
Yea VPS, could it be the env somehow?
it’s running in a docker container, same docker file as it always has (and we think it worked in the past)
the env should be the same but who knows
@Ping So this is our setup. I know we're clutching at straws but I'm not seeing really any obvious reason this would only be happening with Discord, even though this does only happen on prod. Is there any other info we could give you?
Happy to share anything
As we really need to get this fixed, our app is live w/ users
Just alerted Bekacru, as I'm not sure of the cause 🤔
confirm me you're on latest and also are you using mongodb locally?
We’re using two different mongo instances (different containers) hosted on the same VPS. Both access using user + pass auth via ip and port (External URLs for both)
Under the same prod mongo instance under a different database name we have another app using discord oauth and it seems to work fine
can you try
npm i https://pkg.pr.new/better-auth/better-auth@3038
this version?
I couldn't reproduce it either but the only reason a user would be re-registed is if the db didn't return a user with the email or providerId+accountIdcc @Stephen
not home for another ~1.5 hrs
Working ok locally, pushing now
@bekacru IT WORKED!!!
I'm now logging into my first and original Discord account!
Thank you so much. What was the fix??
my guess is
and
check on the mongodb adapter wasn't poroperly working (maybe)
were you on latest both prod and dev?We were on 1.2.9
Thank you so much
npm i https://pkg.pr.new/better-auth/better-auth@bfe4c37
try this version, since the last one includes something we're losing by going that routeWorking!