# Feature: create default user name from email's user portion when using Google OAuth2/SSO

**URL:** https://meta.discourse.org/t/feature-create-default-user-name-from-emails-user-portion-when-using-google-oauth2-sso/178918
**Category:** Feature
**Created:** [February 8, 2021, 3:53pm UTC](https://meta.discourse.org/t/feature-create-default-user-name-from-emails-user-portion-when-using-google-oauth2-sso/178918 "2021-02-08T15:53:45Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Godmar\_Back](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/godmar_back/32/206246_2.png) [@Godmar\_Back](https://meta.discourse.org/u/Godmar_Back)
#### Post date: [February 8, 2021, 3:53pm UTC](https://meta.discourse.org/t/feature-create-default-user-name-from-emails-user-portion-when-using-google-oauth2-sso/178918/1 "2021-02-08T15:53:45Z")

</div>

I hope it’s ok to post random feature requests/suggestions here.

I have a Discourse instance set up so that users can authenticate with a Google Apps Hosted Domain (in my case `@vt.edu`). I have observed that Discourse assigns user names based on combining first + last name it obtains via OAuth2 - e.g., `First_Last`.

What I’d much prefer is if the proposed username matched the user portion of the email account `user@vt.edu` since `user` is an identifier used elsewhere whereas `First_Last` is not. Moreover, `First_Last` is not guaranteed to be unique (`John_Smith`) whereas the user id is. This would for my use case help with the [data explorer](https://meta.discourse.org/t/32566?silent=true) plugin when I need to match statistics against other records and just provide an overall more uniform experience.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [January 17, 2022, 9:54pm UTC](https://meta.discourse.org/t/feature-create-default-user-name-from-emails-user-portion-when-using-google-oauth2-sso/178918/2 "2022-01-17T21:54:16Z")

</div>

I believe @andrei removed this altogether as there were privacy implications when “automatically” creating a username based on email?

---

<div class="post-metadata">

### Author: ![andrei](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/andrei/32/205142_2.png) [@andrei](https://meta.discourse.org/u/andrei)
#### Post date: [January 18, 2022, 8:13pm UTC](https://meta.discourse.org/t/feature-create-default-user-name-from-emails-user-portion-when-using-google-oauth2-sso/178918/3 "2022-01-18T20:13:05Z")

</div>

Not exactly. We’re not removing this, we’re just disabling it with ability to turn it on using the `use_email_for_username_and_name_suggestions` site setting.

Also, note that this change is done for [DiscourseConnect](https://meta.discourse.org/t/discourseconnect-official-single-sign-on-for-discourse-sso/13045), but not for other authentication methods (including authentication via Google). But the fix for other methods is coming soon.

Also, when generating username, full name have priority over email, authenticators try to use email for username suggestions only if the `username` and `full-name` fields in the payload are empty. This is something that can be customized with a plugin. But using email as the main source for username suggestions isn’t something that we want to do by default, especially for authentication via Google. The reason is that in this case, it’s possible to figure out emails of all users on the forum just by adding `@gmail.com` to usernames.
