My app has used default/password-based auth for a while. I would like to add other auth plugins, Google for example. I can get it working fine, but have an issue.
I have auth.use_username=False, so email is used as the username. If an existing user /email with a password now chooses to authenticate using Google instead, a new user account is created for that user. Now there are 2 auth_user rows with the same email.
Ideally, the same user (identified by email address) could be authenticated in more than one way. In practice, I would not expect them to switch between the 2 - rather, they see that Google authentication is now available and decide to use that. So I thought that perhaps there was a reason why the 2 cannot co-exist, but I tested this by copying the sso_id from the new account into the record for the old account, and deleting the new account. I then tried to login with both methods, and both work fine.
So it should all work as I want, but the duplicate-account creation in auth_user is a bother. How can I stop that from happening?