Nextcloud remote imap authentication

NethServer Version: 7.9 fully updated april 9th 2021
Module: latest nextcloud available through yum

Hi all,

what would be the best (if possible at all) way to authenticate in Nextcloud against a remote imap server (in this case gmail)

I want to be able that users with a gmail account on a corp domain can authenticate against Nextcloud via email/ password of that gmail account, and that from there the corp domain email is used to and from messages within Nextcloud.

I saw some old Github auth methods (against a own imap server), but I fail. So first I would like to know if it is possible, then how.

I’ve searched but maybe not well enough:-)

TIA!

That would require enough customization that you’d probably be better off with a manual installation of Nextcloud, rather than the Nethserver packages–that way you wouldn’t see your customization undone with a template expansion.

With that said, if you want to use IMAP, the docs here would seem to be relevant:

Were it up to me, I’d probably be looking at using OpenID Connect instead, which would implement SSO through Google.

Check if any of this is of use:
Social Login App (google)
External user authentication App (documentation)
OpenID Connect Login App
(Bonus: Google integration App)
https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/oauth2.html

Thanks both. Need to dig in a little deeper. Will report back my results.

I am trying with the build in user backend mechanism, but I wonder in general how to cope with gmail accounts that have a 2FA enabled, and most of them if not all are. For instance, when I log in into my personal hmail account, I have to approve the attempt on my cell phone.

I can’t find anything in any log (messages as well as nextcloud log)

Gmail has a “par app password” available for 2FA or non-Oath2 supporting applications

This one I guess?

https://support.google.com/accounts/answer/185833?hl=en#zippy=%2Cwhy-you-may-need-an-app-password

Yes it is.

Thanks!