Whitelist email domains during Google OAuth. #4042

Open
opened 2025-11-02 05:35:21 -06:00 by GiteaMirror · 5 comments
Owner

Originally created by @Ragnaruk on GitHub (Oct 1, 2019).

  • Gitea version (or commit ref): 1.9.3
  • Git version: 2.22.0
  • Operating system: Alpine Linux
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant
  • Log gist:

Description

Hello.

Is it possible to filter email domains of registering users if I'm using Google as an OAuth2 provider? I've tried setting EMAIL_DOMAIN_WHITELIST in config, but it doesn't seem to work.

Thanks.

Originally created by @Ragnaruk on GitHub (Oct 1, 2019). <!-- NOTE: If your issue is a security concern, please send an email to security@gitea.io instead of opening a public issue --> <!-- 1. Please speak English, this is the language all maintainers can speak and write. 2. Please ask questions or configuration/deploy problems on our Discord server (https://discord.gg/gitea) or forum (https://discourse.gitea.io). 3. Please take a moment to check that your issue doesn't already exist. 4. Please give all relevant information below for bug reports, because incomplete details will be handled as an invalid report. --> - Gitea version (or commit ref): 1.9.3 - Git version: 2.22.0 - Operating system: Alpine Linux - Database (use `[x]`): - [ ] PostgreSQL - [X] MySQL - [ ] MSSQL - [ ] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [ ] No - [X] Not relevant - Log gist: ## Description Hello. Is it possible to filter email domains of registering users if I'm using Google as an OAuth2 provider? I've tried setting `EMAIL_DOMAIN_WHITELIST` in config, but it doesn't seem to work. Thanks.
GiteaMirror added the issue/confirmedtype/enhancement labels 2025-11-02 05:35:21 -06:00
Author
Owner

@bagasme commented on GitHub (Oct 4, 2019):

@lunny What about kind/question label for this issue?

@bagasme commented on GitHub (Oct 4, 2019): @lunny What about kind/question label for this issue?
Author
Owner

@stale[bot] commented on GitHub (Dec 4, 2019):

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.

@stale[bot] commented on GitHub (Dec 4, 2019): This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.
Author
Owner

@stale[bot] commented on GitHub (Dec 18, 2019):

This issue has been automatically closed because of inactivity. You can re-open it if needed.

@stale[bot] commented on GitHub (Dec 18, 2019): This issue has been automatically closed because of inactivity. You can re-open it if needed.
Author
Owner

@stale[bot] commented on GitHub (Feb 16, 2020):

This issue has been automatically marked as stale because it has not had recent activity. I am here to help clear issues left open even if solved or waiting for more insight. This issue will be closed if no further activity occurs during the next 2 weeks. If the issue is still valid just add a comment to keep it alive. Thank you for your contributions.

@stale[bot] commented on GitHub (Feb 16, 2020): This issue has been automatically marked as stale because it has not had recent activity. I am here to help clear issues left open even if solved or waiting for more insight. This issue will be closed if no further activity occurs during the next 2 weeks. If the issue is still valid just add a comment to keep it alive. Thank you for your contributions.
Author
Owner

@Brayyy commented on GitHub (Apr 25, 2022):

Having the same issue. We're running with Google OAuth2 as our Authentication Source. We want to limit login/sign-up to our own Google company domains only, disallowing me to sign up using my personal [at]gmail.com account.

Our Grafana is currently configured to do this. Trying to log in via Google using unknown domains results in "Login Failed, required email domain not fulfilled".

The EMAIL_DOMAIN_WHITELIST option enforces that the new account being added meets the domain requirements, but it isn't enough to stop some rando from stopping by and setting up an account using their gmail account.

@Brayyy commented on GitHub (Apr 25, 2022): Having the same issue. We're running with Google OAuth2 as our Authentication Source. We want to limit login/sign-up to our own Google company domains only, disallowing me to sign up using my personal [at]gmail.com account. Our Grafana is currently configured to do this. Trying to log in via Google using unknown domains results in "Login Failed, required email domain not fulfilled". The `EMAIL_DOMAIN_WHITELIST` option enforces that the new account being added meets the domain requirements, but it isn't enough to stop some rando from stopping by and setting up an account using their gmail account.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#4042