Allow a user to link their Discord account after registering with email
NextAuthJS makes this a little hard. Ideally a user should be able to sign up via email and then at some later date link in their Discord account. This should update the website's account database with those discord credentials so we can then associate their contributions with their discord id from that point on.
I'm not 100% sure how to do this so if anyone wants to dive deep into NextAuthJS and figure this out (or do something a little custom that fits within NextAuthJS) that'll be a big help.
I decided to do a bit of digging and it turns out it’s actually quite a hassle to implement multi-provider logins for nextauth as seen in this discussion Multiple accounts with same mail handling #2808, but there seems to be a built-in work around that seems to solve it but i have yet to actually test it.
To get it to work the user must use the same email for both open assistant and discord and enable allowDangerousEmailAccountLinking: true in the provider configuration as seen in the docs here and here
based on the docs I assume it should look something like this in our [..nextauth.ts]
providers.push(
DiscordProvider({
clientId: process.env.DISCORD_CLIENT_ID,
clientSecret: process.env.DISCORD_CLIENT_SECRET,
allowDangerousEmailAccountLinking: true
})
);
}
If this hasn't already been implemented into the codebase by @poipiii, I'd be happy to do a pull request to do this work at some point over this week?
Sure, I haven't seen a PR for this yet so it's open for someone to look at
Got held up this weekend, going to do this tonight, sorry for the delay
Unassigned myself, I ran into errors when I tried to do this, not sure why and I don't have time to debug. Apologies, should have unassigned myself from this earlier
No worries, I'm actually going to close this as we're changing how auth works and will fix it via that update.