Gsuite smtp oauth #4885

Closed
opened 2025-11-02 06:06:11 -06:00 by GiteaMirror · 6 comments
Owner

Originally created by @cromerc on GitHub (Feb 18, 2020).

  • Gitea version (or commit ref): 1.11.1
  • Git version: 2.20.1
  • Operating system: Debian
  • 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

I use gsuite from google to send emails from my gitea server. This is done through what google calls an SMTP relay. However a problem will be coming up in the future to continue using it since they will start blocking access using only username and password, they will require the use of oauth2.

Right now my config for email looks like this:
ENABLED = true
MAILER_TYPE = smtp
HOST = smtp-relay.gmail.com:465
FROM = gitea@mydomain.com
USER = myusername@mydomain.com
PASSWD = mypassword
HELO_HOSTNAME = mydomain.com
IS_TLS_ENABLED = true

This is what I received in an email from google:

June 15, 2020 - Users who try to connect to an LSA for the first time will no longer be able to do so.
This includes third-party apps that allow password-only access to Google calendars, contacts, and email via protocols such as CalDAV, CardDAV and IMAP.
Users who have connected to LSAs prior to this date will be able to continue using them until usage of all LSAs is turned off.
February 15, 2021 - Access to LSAs will be turned off for all G Suite accounts.

So in June nobody will be able to use gmail server with gitea except for those people that were already using it before that date. Then in February of 2021 it will stop working for everyone including myself.

I don't know why, but it already effected me now, for some reason LSA was disabled automatically on my account and all emails from gitea were failing to be sent. I re-enabled LSA for now, but that is only a temporary solution.

To get around this problem oauth2 support will have to be added. I don't know if this is the right page, but here is some info on oauth2 with smtp from google: https://developers.google.com/gmail/imap/xoauth2-protocol

Originally created by @cromerc on GitHub (Feb 18, 2020). <!-- 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.11.1 - Git version: 2.20.1 - Operating system: Debian - 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 I use gsuite from google to send emails from my gitea server. This is done through what google calls an [SMTP relay.](https://support.google.com/a/answer/2956491) However a problem will be coming up in the future to continue using it since they will start blocking access using only username and password, they will require the use of oauth2. Right now my config for email looks like this: ENABLED = true MAILER_TYPE = smtp HOST = smtp-relay.gmail.com:465 FROM = gitea@mydomain.com USER = myusername@mydomain.com PASSWD = mypassword HELO_HOSTNAME = mydomain.com IS_TLS_ENABLED = true This is what I received in an email from google: > June 15, 2020 - Users who try to connect to an LSA for the first time will no longer be able to do so. > This includes third-party apps that allow password-only access to Google calendars, contacts, and email via protocols such as CalDAV, CardDAV and IMAP. > Users who have connected to LSAs prior to this date will be able to continue using them until usage of all LSAs is turned off. > February 15, 2021 - Access to LSAs will be turned off for all G Suite accounts. So in June nobody will be able to use gmail server with gitea except for those people that were already using it before that date. Then in February of 2021 it will stop working for everyone including myself. I don't know why, but it already effected me now, for some reason [LSA](https://support.google.com/a/answer/6260879) was disabled automatically on my account and all emails from gitea were failing to be sent. I re-enabled LSA for now, but that is only a temporary solution. To get around this problem oauth2 support will have to be added. I don't know if this is the right page, but here is some info on oauth2 with smtp from google: https://developers.google.com/gmail/imap/xoauth2-protocol
GiteaMirror added the issue/confirmedtype/enhancement labels 2025-11-02 06:06:11 -06:00
Author
Owner

@lafriks commented on GitHub (Feb 18, 2020):

Why not just use Google oauth2 for login?

@lafriks commented on GitHub (Feb 18, 2020): Why not just use Google oauth2 for login?
Author
Owner

@cromerc commented on GitHub (Feb 18, 2020):

I do use google oauth2 for login, that is unrelated to this problem. This is about the emails sent by the gitea service through google smtp server, not about login.

@cromerc commented on GitHub (Feb 18, 2020): I do use google oauth2 for login, that is unrelated to this problem. This is about the emails sent by the gitea service through google smtp server, not about login.
Author
Owner

@lafriks commented on GitHub (Feb 18, 2020):

Oh, ok, sorry, misunderstood issue

@lafriks commented on GitHub (Feb 18, 2020): Oh, ok, sorry, misunderstood issue
Author
Owner

@techknowlogick commented on GitHub (Feb 19, 2020):

Our built in mail library may not support oauth2, however with @zeripath's mail refactoring we may be able to add another type of mail provider using https://godoc.org/google.golang.org/api/gmail/v1 (see https://github.com/go-gitea/gitea/blob/master/custom/conf/app.ini.sample#L631 for more details about alternative mail providers).

@techknowlogick commented on GitHub (Feb 19, 2020): Our built in mail library may not support oauth2, however with @zeripath's mail refactoring we may be able to add another type of mail provider using https://godoc.org/google.golang.org/api/gmail/v1 (see https://github.com/go-gitea/gitea/blob/master/custom/conf/app.ini.sample#L631 for more details about alternative mail providers).
Author
Owner

@stale[bot] commented on GitHub (Apr 19, 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 (Apr 19, 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

@twisted-nematic57 commented on GitHub (Nov 11, 2022):

Not stale we need this

@twisted-nematic57 commented on GitHub (Nov 11, 2022): Not stale we need this
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#4885