Unable to connect to mail server

I am using postfix/dovecot on a Centos 7 box. When I try to connect to it via nextcloud, I get this error:
Creating account failed: Authentication failed.
Here is the tutorial that I followed to setup my mail server: https://www.linode.com/docs/email/postfix/email-with-postfix-dovecot-and-mariadb-on-centos-7/
For Imap settings:
Imap host: my server IP
Security: SSL/TLS
Port: 993
User: username (e.g. from username@domain.com)
Password: Password of user’s local linux user account?

SMTP:
IP
SSL
587
username
Password

This is just a guess, but isn’t port 587 on SMTP actually STARTTLS, not SSL? (I think SSL is port 465 or something off the top of my head).

Do your settings work elsewhere? (e.g. Thunderbird or Outlook?)

Just reexamining my setup, and I didn’t specify a port. I just chose STARTTLS and left the port blank. Have you tried that?

Also, weirdly, if I leave “Authentication required” unchecked it still works. Have you tried that?

Lastly I’ve left authentication as plain, what did you chose?

If I try anything other than SSL/TLS for IMAP, it fails.
I’ve tried every option for the SMTP security, and it still fails.
In mine, I do not have that checkbox. I am using manual mode. What version are you running?
I tried plain as well, but it also fails.

maillog file:
Nov 24 22:59:04 mail dovecot: imap-login: Disconnected (auth failed, 2 attempts in 7 secs): user=, method=PLAIN, rip=IP, lip=IP, TLS, session=

I am also seeing this:
Nov 24 23:25:16 mail.domain.com postfix/smtps/smtpd[1384]: warning: SASL: Connect to private/auth failed: Connection refused
Nov 24 23:25:16 mail.domain.com postfix/smtps/smtpd[1384]: fatal: no SASL authentication mechanisms

Also this:
Nov 24 23:36:33 mail.domain.com auth[1603]: pam_unix(dovecot:auth): authentication failure; logname= uid=5000 euid=5000 tty=dovecot ruser=username rhost= user=username
When doing a status on dovecot.