IMAP username or password is wrong

Nextcloud version: 30.0.0
Operating system and version: ´Ubuntu 24.04 VM on ESXi 7.0 U3Apache or nginx version: 2.4.58PHP version:8.3.6`

The issue you are facing: Can´t add microsoft e-mail account. It won´t authenticate. Display error: IMAP username or password is wrong.

Groupware/Microsoft integration is OFF. When turned ON, the same error appears.

Is this the first time you’ve seen this error? (Y/N): Y - fresh install.

Steps to replicate it:

  1. Click on the envelop on the top menu
  2. Populate name, mail address and password
  3. Click connect

The output of your Nextcloud log in Admin > Logging:

[no app in context] Warning: Invalid microsoft_oauth_client_id data provided to provideInitialState by mail
	GET /index.php/settings/admin/groupware
	from 10.10.10.60 by mello at Oct 1, 2024, 11:41:57 AM

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php
$CONFIG = array (
  'instanceid' => 'och8cixtm7c0',
  'passwordsalt' => '',
  'secret' => 'xxx',
  'trusted_domains' => 
  array (
    0 => 'nextcloud.xxx.yyy',
  ),
  'datadirectory' => '/var/www/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '30.0.0.14',
  'overwrite.cli.url' => 'http://nextcloud.xxx.yyy',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextclouddbuser',
  'dbpassword' => 'MyStrongPassword!@#432',
  'installed' => true,
  'maintenance' => false,
);

The output of your Apache/nginx/system log in /var/log/____:

Sep 29 23:43:32 nextcloud systemd[1]: Started apache2.service - The Apache HTTP Server.
Sep 30 21:36:56 nextcloud systemd[1]: Stopping apache2.service - The Apache HTTP Server...
Sep 30 21:36:56 nextcloud apachectl[209985]: AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
Sep 30 21:36:56 nextcloud systemd[1]: apache2.service: Killing process 143065 (coolwsd) with signal SIGKILL.
Sep 30 21:36:56 nextcloud systemd[1]: apache2.service: Killing process 143094 (forkit) with signal SIGKILL.
Sep 30 21:36:56 nextcloud systemd[1]: apache2.service: Killing process 143179 (kit_spare_002) with signal SIGKILL.
Sep 30 21:36:56 nextcloud systemd[1]: apache2.service: Killing process 143180 (kit_spare_003) with signal SIGKILL.
Sep 30 21:36:56 nextcloud systemd[1]: apache2.service: Killing process 148651 (apache2) with signal SIGKILL.
Sep 30 21:36:56 nextcloud systemd[1]: apache2.service: Killing process 174457 (apache2) with signal SIGKILL.
Sep 30 21:36:56 nextcloud systemd[1]: apache2.service: Killing process 174525 (apache2) with signal SIGKILL.
Sep 30 21:36:56 nextcloud systemd[1]: apache2.service: Killing process 174945 (kit_spare_010) with signal SIGKILL.
Sep 30 21:36:56 nextcloud systemd[1]: apache2.service: Killing process 181328 (apache2) with signal SIGKILL.
Sep 30 21:36:56 nextcloud systemd[1]: apache2.service: Killing process 181850 (apache2) with signal SIGKILL.
Sep 30 21:36:56 nextcloud systemd[1]: apache2.service: Killing process 187615 (apache2) with signal SIGKILL.
Sep 30 21:36:56 nextcloud systemd[1]: apache2.service: Killing process 200148 (apache2) with signal SIGKILL.
Sep 30 21:36:56 nextcloud systemd[1]: apache2.service: Killing process 201066 (apache2) with signal SIGKILL.
Sep 30 21:36:56 nextcloud systemd[1]: apache2.service: Deactivated successfully.
Sep 30 21:36:56 nextcloud systemd[1]: Stopped apache2.service - The Apache HTTP Server.
Sep 30 21:36:56 nextcloud systemd[1]: apache2.service: Consumed 4min 18.640s CPU time.
-- Boot 7fe18b10d9af410784388581315946cf --
Sep 30 21:37:19 nextcloud systemd[1]: Starting apache2.service - The Apache HTTP Server...
Sep 30 21:37:19 nextcloud apachectl[1353]: AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
Sep 30 21:37:19 nextcloud systemd[1]: Started apache2.service - The Apache HTTP Server.
Oct 01 00:00:01 nextcloud systemd[1]: Reloading apache2.service - The Apache HTTP Server...
Oct 01 00:00:01 nextcloud apachectl[3765]: AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
Oct 01 00:00:01 nextcloud systemd[1]: Reloaded apache2.service - The Apache HTTP Server.

Output errors in nextcloud.log in /var/www/ or as admin user in top right menu, filtering for errors. Use a pastebin service if necessary.

Error	no app in context	
RuntimeException
image not found: image:apps/whiteboard.svg webroot: serverroot:/var/www/nextcloud

Oct 1, 2024, 10:46:27 AM	

Error	no app in context	
RuntimeException
image not found: image:apps/whiteboard.svg webroot: serverroot:/var/www/nextcloud

Oct 1, 2024, 10:46:22 AM	

Error	no app in context	
RuntimeException
image not found: image:apps/whiteboard.svg webroot: serverroot:/var/www/nextcloud

Oct 1, 2024, 10:46:08 AM	

Error	no app in context	
RuntimeException
image not found: image:apps/whiteboard.svg webroot: serverroot:/var/www/nextcloud

Oct 1, 2024, 10:44:52 AM	

Error	no app in context	
RuntimeException
image not found: image:apps/whiteboard.svg webroot: serverroot:/var/www/nextcloud

Oct 1, 2024, 10:44:02 AM	

Error	no app in context	
RuntimeException
image not found: image:apps/whiteboard.svg webroot: serverroot:/var/www/nextcloud

Oct 1, 2024, 10:40:30 AM
 

Microsoft did announce to disable basic authentification on Oct. 1st on Exchange online. So only OAUTH will work anymore. But I don’t know, whether their Outlook- and hotmail accounts are affected, too.

Maybe this might help:
https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/oauth2.html
(I hope, I did link the correct guide)

Thanks for your reply. I’m not sure that MS announcement was the problem, as my install was done before that date and was having the error at that time.

What account should be accessed? - Exchange Server, Outlook.com, Hotmail, etc.?

Concerning

please find the bug-report:

September 16th, 2024:
Basic Authentication no longer available to access any Outlook account

Source.

GitHub Issue:

You’ll have to wait until someone implements oAuth2 support for Hotmail/Outlook.

Thanks for the info. Will move to my IMAP server, where I have more control.

Unfortunatelly you did not answer my question concerning the mail server.

FYI:
For example: Exchange server has disabled IMAP-access by default, so IMAP only will work after enabling it by administrator.