nextcloud / user_external

👥 External user authentication methods like IMAP, SMB and FTP
https://apps.nextcloud.com/apps/user_external
108 stars 64 forks source link

Can't log in with gmail imap #47

Closed xattab closed 5 years ago

xattab commented 5 years ago

Hi! Try enable User authentication with IMAP In config.php set this

'user_backends' => array( array( 'class' => 'OC_User_IMAP', 'arguments' => array( '{imap.gmail.com:143/imap/readonly}', 'gmail.com' ), ), ), And try login to my nextcloud with gmail credentials

Actual behaviour

get error in nextcloud/data/nextcloud.log {"reqId":"BxNNonT7i6PQchT7C87r","level":3,"time":"2019-03-11T13:57:16+00:00","remoteAddr":"104.248.27.211","user":"--","app":"user_external","method":"POST","url":"\/login","message":"ERROR: IMAP Error: Array\n(\n [0] => Connection failed to gmail-imap.l.google.com,143: Connection timed out\n [1] => Connection failed to gmail-imap.l.google.com,143: Connection timed out\n [2] => Can't connect to gmail-imap.l.google.com,143: Cannot assign requested address\n)\n","userAgent":"Mozilla\/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/72.0.3626.119 Safari\/537.36","version":"15.0.5.3"} {"reqId":"BxNNonT7i6PQchT7C87r","level":2,"time":"2019-03-11T13:57:16+00:00","remoteAddr":"104.248.27.211","user":"--","app":"core","method":"POST","url":"\/login","message":"Login failed: 'slobodam90@gmail.com' (Remote IP: '104.248.27.211')","userAgent":"Mozilla\/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/72.0.3626.119 Safari\/537.36","version":"15.0.5.3"} -->

Operating system: Debian 9

Web server: nginx Database: mysql PHP version: php7.0 Nextcloud version: (see Nextcloud admin page) 15 Updated from an older Nextcloud/ownCloud or fresh install: fresh install Where did you install Nextcloud from: bare-metal server

violoncelloCH commented 5 years ago

Please note, that Gmail is quite strict with IMAP access. They wan't you to use OAuth to authenticate, what is obviously not the case if you use it like that with user_external for authenticating in Nextcloud. If I'm right, there is a setting in Gmail called something like "enable/allow 'less secure' apps". Can you make sure that IMAP access without Oauth is allowed in Gmail?

MariusBluem commented 5 years ago

Please not that this is neither a supported use-case nor a good idea to do :) With the commercial G Suite (known as Google Apps for Business) you could use it with the explanations from @violoncelloCH but with Gmail for home users (account username ending with @gmail.com) you should definetly not use it, since otherwise all @gmail.com users will be able to authenticate against your Nextcloud instance. Keep this in mind before setting this up ⚠️

Since this use-case is not supported and will not be maintained I will close this ticket now.