Clashing usernames on different 3rd party providers

#4998 referenced this issue back on Github, but I believe nothing was changed.

In the current system, two different users who share the same email prefix (i.e. andrew@gmail and andrew@hotmail) will cause errors when trying to sign up as their username will clash. This isn’t a problem with email signup as a username can be sent with the create request, but as far as I can tell this is not possible for 3rd party auth signup.

I am trying to implement a workaround here in which a user must specify a username before they sign up, but the 3rd party auth callback does not seem to take a username field.

What I am going for is something similar to the signup flow of this site - where the sign up flow is changed so that clashing usernames don’t reject the create request when using 3rd party providers.

Does anyone know what I should be editing in the user-permissions plugin in order to change how the username for a 3rd party auth user is created?

Or rather than change the plugin, perhaps any other workarounds.

I am relatively new to strapi so apologies if this is simple.


Absolutely not simple and thank you for the question. We do know of the conflict, and it’s a difficult one to manage as we need something to be unique. We recently changed the Admin panel itself to only set the email as unique but have not made that change to the users-permissions plugin.

This file is most likely the one you are going to need to modify, and it largely depends on what you are trying to do: