Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ADD] {google,fetchmail}_gmail: OAuth for gmail servers #64213

Closed
wants to merge 1 commit into from

Conversation

std-odoo
Copy link
Contributor

@std-odoo std-odoo commented Jan 7, 2021

Purpose

Less secured apps are no longer supported by google, therefore, we need
to transition to the OAuth2 authentication system.

Specifications

On the external server configuration in the main settings, users will
have to activate Gmail support.

Then, on incoming / outgoing mail servers forms, they will have to
introduce an authorization code that they will have fetched via a link
on the form.

Task-2170676

@std-odoo std-odoo requested review from a team as code owners January 7, 2021 13:46
@robodoo
Copy link
Contributor

robodoo commented Jan 7, 2021

@C3POdoo C3POdoo added the RD research & development, internal work label Jan 7, 2021
@std-odoo std-odoo closed this Jan 7, 2021
@std-odoo std-odoo reopened this Jan 7, 2021
@std-odoo std-odoo changed the title [ADD] {google,fetchmail,outgoing}_gmail: OAuth for gmail servers [ADD] {google,fetchmail}_gmail: OAuth for gmail servers Jan 8, 2021
@std-odoo std-odoo force-pushed the master-fetchmail-gmail-std branch 7 times, most recently from c2b44a6 to d89c925 Compare January 13, 2021 12:59
@std-odoo std-odoo force-pushed the master-fetchmail-gmail-std branch 2 times, most recently from d67cd2d to bddfdbd Compare January 21, 2021 09:58
@mccarthysean
Copy link

mccarthysean commented Feb 15, 2021

Is this going to work for Microsoft Office 365 incoming emails as well as Gmail? Microsoft Office 365 is also switching to "Modern Authentication" (i.e. forcing everyone to use OAUTH 2.0 starting in 2021). Our company's Microsoft Office 365 service requires "modern authentication" already, so Odoo incoming email does not work for us.

@yajo
Copy link
Contributor

yajo commented Mar 17, 2021

Wouldn't it be better fetchmail_oauth and let it support gmail as well as other oauth providers?

Does it really make sense to ship it in a separate module instead of integrating into fetchmail as a core feature?

@std-odoo
Copy link
Contributor Author

@yajo Hi :) We have some custom code for gmail, like default settings, specific view, the URL to which the user is redirected for the authentication, also the endpoints are not the same, we use a google mixin, etc.. To much thing "google specific" IMO. Generally we prefer to do 1 module per "media", it's easier to maintain (except if we found a stoing argument to merge both "media" in 1 module, but I don't think it will be the case).

But some code can be re-used like _generate_oauth2_string when we will develop the "fetchmail_outlook" module

@std-odoo std-odoo force-pushed the master-fetchmail-gmail-std branch from a3cabe2 to 0d14661 Compare June 7, 2021 06:42
@std-odoo std-odoo force-pushed the master-fetchmail-gmail-std branch 2 times, most recently from 279c175 to 1d34d58 Compare September 13, 2021 09:03
@std-odoo std-odoo force-pushed the master-fetchmail-gmail-std branch 5 times, most recently from 1e23e1e to 1875b97 Compare December 10, 2021 11:43
Copy link
Contributor

@tde-banana-odoo tde-banana-odoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Validation ! Read the diff, seems quite short in the end, cool :) added some comments notably to try to improve google.service usage and modularity :)

Cheers !

addons/fetchmail/models/fetchmail.py Outdated Show resolved Hide resolved
addons/fetchmail/models/fetchmail.py Outdated Show resolved Hide resolved
addons/fetchmail/views/fetchmail_views.xml Outdated Show resolved Hide resolved
odoo/addons/base/models/ir_mail_server.py Outdated Show resolved Hide resolved
addons/mail/models/res_config_settings.py Outdated Show resolved Hide resolved
addons/google_gmail/models/google_gmail_mixin.py Outdated Show resolved Hide resolved
addons/fetchmail_gmail/models/fetchmail_server.py Outdated Show resolved Hide resolved
addons/fetchmail_gmail/models/fetchmail_server.py Outdated Show resolved Hide resolved
addons/fetchmail_gmail/__manifest__.py Outdated Show resolved Hide resolved
addons/fetchmail_gmail/__manifest__.py Outdated Show resolved Hide resolved
@std-odoo std-odoo force-pushed the master-fetchmail-gmail-std branch 2 times, most recently from e323cfc to 2ad3e5f Compare January 4, 2022 09:18
Copy link
Contributor Author

@std-odoo std-odoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tde-banana-odoo Hi :)

I made the changes and answered to your questions

addons/fetchmail_gmail/models/fetchmail_server.py Outdated Show resolved Hide resolved
addons/mail/models/res_config_settings.py Outdated Show resolved Hide resolved
addons/fetchmail_gmail/__manifest__.py Outdated Show resolved Hide resolved
addons/google_gmail/models/google_gmail_mixin.py Outdated Show resolved Hide resolved
addons/google_gmail/models/google_gmail_mixin.py Outdated Show resolved Hide resolved
addons/google_gmail/models/google_gmail_mixin.py Outdated Show resolved Hide resolved
addons/google_gmail/models/google_gmail_mixin.py Outdated Show resolved Hide resolved
addons/google_gmail/models/google_gmail_mixin.py Outdated Show resolved Hide resolved
addons/fetchmail/views/fetchmail_views.xml Outdated Show resolved Hide resolved
Copy link
Contributor

@tde-banana-odoo tde-banana-odoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blourtch !

addons/google_gmail/models/google_gmail_mixin.py Outdated Show resolved Hide resolved
addons/google_gmail/models/ir_mail_server.py Outdated Show resolved Hide resolved
odoo/addons/base/models/ir_mail_server.py Outdated Show resolved Hide resolved
@tde-banana-odoo
Copy link
Contributor

By the way, could be great to have a review from @odony as he is able to send emails directly from his brain. And to check if we are doing thinkgs like we should.

Cheers !

@std-odoo std-odoo force-pushed the master-fetchmail-gmail-std branch 5 times, most recently from efaa8df to fe701fb Compare January 13, 2022 08:20
Purpose
=======
Less secured apps are no longer supported by google, therefore, we need
to transition to the OAuth2 authentication system.

Specifications
==============
On the external server configuration in the main settings, users will
have to activate Gmail support.

Then, on incoming / outgoing mail servers forms, they will have to
click that will redirect them to Gmail, where they will accept the
permission of the application. When, they will copy / paste the token
in the Odoo email server form view. This token is used in replacement
of their password.

Task-2170676
@tde-banana-odoo
Copy link
Contributor

@xmo-odoo @mart-e Could you have a look at this one ? Requiring security review and in any way, a review from someone smarter than me (not complicated but hey).

Copy link
Contributor

@mart-e mart-e left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@robodoo override=ci/security
Reason: request on gmail servers using the API
Looks good on the feature :)

@std-odoo
Copy link
Contributor Author

Master change will be merged in: #83413

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RD research & development, internal work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants