Calendar sync to IOS fails. Using TOTP

I have setup Nextcloud in a docker container and run it behind HaProxy. Everything seems to work except syncing the calendar to both Windows and IOS. It seems to be an authentication issue as the logs suggest (401).

I am using TOTP for two factor authentication. This works well but I think the issue might lie there. I used the right username and password for my account. Additionally I tried adding an app password and using it. Although there I am not sure wether I have to use the same username or something else.

My Nextcloud version is 28, SSL is managed by acme.sh and is in order.

Here’s my docker-compose.yml

services:
  db:
    image: mariadb:10.5
    command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
    restart: always
    volumes:
      - db:/var/lib/mysql
    env_file:
      - db.env

  redis:
    image: redis:alpine
    restart: always

  app:
    image: nextcloud:28-apache
    restart: always
    ports:
      - 80:80
    volumes:
      - nextcloud:/var/www/html
      - ./config:/var/www/html/config
      - /data/nextcloud:/var/www/html/data
    environment:
      - MYSQL_HOST=db
      - REDIS_HOST=redis
    env_file:
      - db.env
    depends_on:
      - db
      - redis
    networks:
      - default

  cron:
    image: nextcloud:28-apache
    restart: always
    volumes:
      - nextcloud:/var/www/html
      - ./config:/var/www/html/config
      - /data/nextcloud:/var/www/html/data
    entrypoint: /cron.sh
    depends_on:
      - db
      - redis

volumes:
  db:
  nextcloud:

The relevant lines from the logs are

app_1    | 178.197.203.220 - - [20/Jan/2024:10:51:45 +0000] "PROPFIND /remote.php/dav HTTP/1.1" 401 1927 "-" "iOS/17.2.1 (21C66) accountsd/1.0"
app_1    | 178.197.203.220 - Username [20/Jan/2024:10:51:45 +0000] "PROPFIND /remote.php/dav HTTP/1.1" 401 1221 "-" "iOS/17.2.1 (21C66) accountsd/1.0"
app_1    | 178.197.203.220 - - [20/Jan/2024:10:51:46 +0000] "PROPFIND /remote.php/dav HTTP/1.1" 401 1165 "-" "iOS/17.2.1 (21C66) accountsd/1.0"
app_1    | 178.197.203.220 - - [20/Jan/2024:10:51:46 +0000] "PROPFIND / HTTP/1.1" 405 849 "-" "iOS/17.2.1 (21C66) accountsd/1.0"
app_1    | 178.197.203.220 - - [20/Jan/2024:10:51:46 +0000] "PROPFIND /principals/ HTTP/1.1" 405 849 "-" "iOS/17.2.1 (21C66) accountsd/1.0"
app_1    | 178.197.203.220 - - [20/Jan/2024:10:51:46 +0000] "PROPFIND /calendar/dav/Username/user/ HTTP/1.1" 405 849 "-" "iOS/17.2.1 (21C66) accountsd/1.0"

Hope someone can help me with this issue

with mfa you need to create a device password in settings > security an use your username and this password to login.

I did that already and it had the same outcome

Hi @ShadowCrafter !
I had a similar issue and found a solution for it (see here).
Perhaps it may help you …
Best regards!