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

Fetchmail: add support for Oauth2 #42552

Open
StefanRijnhart opened this issue Jan 2, 2020 · 36 comments
Open

Fetchmail: add support for Oauth2 #42552

StefanRijnhart opened this issue Jan 2, 2020 · 36 comments

Comments

@StefanRijnhart
Copy link
Contributor

StefanRijnhart commented Jan 2, 2020

IMAP access to G-Suite will be removed in the near future: https://gsuiteupdates.googleblog.com/2019/12/less-secure-apps-oauth-google-username-password-incorrect.html

If I understand correctly, the critical path seems to be that new installations won't be able to connect to G-Suite for IMAP after 20th of June 2020. It is less clear to me if SMTP access is also being curtailed.

While imaplib has supported Oauth2 authentication for a long time (
http://rakeshmukundan.in/2013/01/23/access-gmail-python-imaplib-and-python-with-oauth2/), it looks like the integration in Odoo is not yet present (https://github.com/odoo/odoo/blob/master/addons/fetchmail/models/fetchmail.py#L103-L108).

@Yenthe666
Copy link
Collaborator

@mart-e I guess you're a good person to give initial feedback on this one :) I saw some topic about this in the past but can't find it anymore. Not even sure if it was on Github.

@yajo

This comment has been minimized.

@StefanRijnhart
Copy link
Contributor Author

Ah sorry, wrong blog post. Here is the blog post mentioning the cutoff dates: https://gsuiteupdates.googleblog.com/2019/12/less-secure-apps-oauth-google-username-password-incorrect.html. I'll update the issue description.

@eLBati
Copy link
Contributor

eLBati commented Jan 3, 2020

I think SMTP will be affected too: accessing to gmail accounts with SMTP does not work without enabling less secure apps (an old issue at #1810)

@rim-odoo
Copy link
Contributor

rim-odoo commented Jan 6, 2020

We are reviewing this question internally and should get back to you soon

(internal task: 2170676)

@fabioce
Copy link

fabioce commented Feb 19, 2020

Any news about this topic?
Thanks

@gurneyalex
Copy link
Contributor

@rim-odoo Hello what's the status on this issue?

@rim-odoo
Copy link
Contributor

@gurneyalex The task has been validated and is worked on internally :)
The fix should be merged before Google removes password authentication for good

@nbessi
Copy link
Contributor

nbessi commented Apr 24, 2020

@rim-odoo any update on that issue. Is there a PR somewhere ?

@rim-odoo
Copy link
Contributor

I got the confirmation that our R&D team is still working on developing a fix for this issue.

Please also note that Google has postponed the removal of basic password authentication, sine die : https://gsuiteupdates.googleblog.com/2020/03/less-secure-app-turn-off-suspended.html

@Shide
Copy link
Contributor

Shide commented Sep 3, 2020

@rim-odoo Any notice about that?

@BT-dschleich
Copy link

@rim-odoo any news yet about the progress?

@ShahRajper
Copy link

@rim-odoo any update/news on this?

@Yenthe666
Copy link
Collaborator

See also #44943 and #64213

@gamarino
Copy link

Access to non-secure apps is banned for google accounts with 2 factor authentication. The only alternative right now is application passwords, that it is not recommended by Google and it should be reconfigured each time the account owner updates his password

@Yenthe666
Copy link
Collaborator

Yes indeed, I've noticed so too. Sadly still not any update/support about this matter from Odoo.

@pavelsodomka
Copy link

Any news after 19 months ?

@Yenthe666
Copy link
Collaborator

This is kinda getting ridiculous. @rim-odoo any update? "should get back to you soon" should be any day now, right? 🤦

@pedrobaeza
Copy link
Collaborator

pedrobaeza commented Sep 2, 2021

@rim-odoo is no longer working at Odoo.

@pavelsodomka
Copy link

Is there still anyone working at Odoo besides the 1700 account managers ? I really think this a basic security requirement pushed both by Google and Microsoft and the fix is rather easy and straightforward. OAuth 2 is not a rocket science.

@Yenthe666
Copy link
Collaborator

Wow, I totally didn't register that.. @odony and @mart-e can you two as main security guys please jump in here?

@mart-e
Copy link
Contributor

mart-e commented Sep 2, 2021

As you have noticed, there is an ongoing development at #64213 (and #64215), so yes, it will land into Odoo, hopefully soon but can't promise you more, sorry.

@Yenthe666
Copy link
Collaborator

There has been zero movements in 9 months though :/

@mgielissen
Copy link

Office365 stops with basic authentication in october 2022
https://office365itpros.com/2021/09/24/basic-authentication-exchange-online-tenants-stops-october-2022/

@JosDeGraeve
Copy link
Contributor

We've gone ahead and opted for smtp for incoming mail, because this is what odoo is using too.
We created an lmtp container that delivers email to an odoo instance
It looks for xmlrpc credentials in a json file, using the destination domain / recipient as key.

https://gitlab.com/Apertoso/docker/odoo-lmtp/-/blob/main/odoo-lmtpd.py

@gurneyalex
Copy link
Contributor

hello @mart-e what is the status of this ? I see #64215 was closed recently, but #64213 is still moving...

@tde-banana-odoo
Copy link
Contributor

hello @mart-e what is the status of this ? I see #64215 was closed recently, but #64213 is still moving...

Hello @gurneyalex ,

Master version PR was used mainly for review, dev and testing. We plan to merge in all major versions (13+) and we will try to backport in 12 if code applies without too much changes (seems to be the case so currently still in our plans). Rationale is that even if 12.0 is EOL people may take time to migrate towards 13.0, hence trying to support it.

Cheers !

@sthibaul
Copy link

sthibaul commented Mar 4, 2022

google announced they will be requiring oauth from May 30th

@gurneyalex
Copy link
Contributor

backport to earlier odoo versions: OCA/social#860

@yajo
Copy link
Contributor

yajo commented Mar 23, 2022

This can be closed, right?

@gurneyalex
Copy link
Contributor

@yajo yes

@eLBati
Copy link
Contributor

eLBati commented May 25, 2022

With odoo 12 I am getting

The redirect URI in the request, urn:ietf:wg:oauth:2.0:oob, can only be used by a Client ID for native application. It is not allowed for the WEB client type. You can create a Client ID for native application at https://console.developers.google.com/apis/credentials/oauthclient

after clicking on Get an Authorization Code on ir.mail_server

Did anyone managed to connect to gmail?

Thanks

@eLBati
Copy link
Contributor

eLBati commented May 25, 2022

Anyway, we are enabling "apps passwords" as a workaround
https://support.google.com/accounts/answer/185833

@blaskurain
Copy link

@eLBati try configuring the access for a Desktop app instead of a web application.

@mlaitinen
Copy link
Contributor

Code exists, no documentation. Typical Odoo.

Ran into the same error message as @eLBati. Changing the application type to a "Desktop app" didn't help. But luckily, I found a workaround for setting up the incoming email using OAuth2.

  1. Follow Odoo's instructions for setting up the OAuth2 login, up until the "Retrieve the Client ID" step
  2. Enable "External Email Servers" in the General Settings (and save)
  3. Store the Client ID and Client Secret under "Gmail Credentials" in the General Settings
  4. Change the google_redirect_uri to http://localhost:8069/auth_oauth/signin (I was running Odoo locally, you might want to enter the real address there)
  5. Create a new incoming mail server, fill in the fields (remember to select "Gmail") and click the authorization URL link
  6. Choose the Google account, allow access, etc.
  7. When the authentication procedure redirects you back to the google_redirect_uri, Odoo displays an error, BUT, you can now copy the authorization code from the URL. Simply copy the part after code= and before &scope=.
  8. Paste the authorization code to the incoming email server settings, save and test.

Not sure whether the google_redirect_uri is used for something else, so you might want to revert that to the original value after performing these steps.

@matteoopenf
Copy link

I try to install on odoo 12.0, but I obtain the module is not completely installed:

image

Someone have the same problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests