Allow username duplication - best solution?


I use only OAuth login in my app. I get usernames using API with #onCreateUser function. The usernames retrieved from API can be the same. My users collection grew recently and I get username duplication error more often. I don’t use usernames to anything more than showing it in few places in my app. What is the best solution to this problem? The easiest one I’ve been thought is changing username field to something like steamUsername, but maybe there is better solution.

Thanks in advance


I think you’ve hit on the solution already.
If the username is only for display purposes and doesn’t need to be unique, then the username field used by Meteor’s Meteor.setUsername() is not for you - as it is there to ensure a unique id, and allow password logins with that name.
You can call the new field pretty much anything you like, ‘handle’, ‘preferredName’, ‘socialName’, ‘displayUser’ etc. whatever makes most sense for your app (‘steamUsername’ is also fine, especially if Steam is the oauth service you’re authenticating with).