If you are a new user to this forum, you could safely ignore this thread and directly use Discord login to create an account.
This thread is for users that have manually created an account here and willing to use discord login with that same discourse account.
Enabling social login is not compatible with discourse 2FA, if you have enabled it, first thing is to turn it off. Once accounts are associated you could turn it on again (but then you lose discord login)
1 - Turning Off 2FA
Go to User Preferences in Discourse:
then go to Security and Manage Two-Factor Authentication then turn off 2FA:
2 - Adding discord email address as alternative email
Now go back to User preferences and add as alternative email the same email address you are using for Discord: ( you don’t need to change your primary email address)
3 - Checking everything is fine
One its done, logout and try to log in with discord:
If everything is ok, in your User preferences, you should see your social account email address linked: